Похожие чаты

Is there no compile time way to get the number

of fields in a struct?

14 ответов

7 просмотров

no 🙂 why do you need it?

anonimikmak- Автор вопроса
Roman Sharkov
no 🙂 why do you need it?

generating some text tables based on a struct bit yikes but for now ive hardcoded the number

This would be a non-issue if Go just allowed multiple entrypoints in one package

anonimikmak- Автор вопроса
Павλо 🇺🇦
bruh, you could just use reflection

obviously i know that's why i specified comptime dumbass it's slow and i hate it

anonimikmak- Автор вопроса

poopy poopoo

anonimikmak
generating some text tables based on a struct bit ...

you sure just writing a function to do that isn't enough?

anonimikmak- Автор вопроса
anonimikmak
write a function to do what

There's a chance you're overengineering the solution to your problem if you require reflection. you could just write a marshaler interface and implement it

anonimikmak- Автор вопроса
Roman Sharkov
There's a chance you're overengineering the soluti...

this is a false perception coming out of an obsession to defend your language

anonimikmak
this is a false perception coming out of an obsess...

maybe, maybe not. If Go fits your problem not so well as for example Zig could - consider doing it in Zig with its comptime. Go is not going to change much anymore.

Похожие вопросы

Обсуждают сегодня

А чем вам питонисты не угодили?😂
.
79
Ребят, а за скок можно впарить анон чат с апишкой и веб админкой ?
Eugene Неелов
15
всем доброго времени суток! имею вопрос: как понять ТОЧНО, что на нексус производится атака или он перегружен? исходные данные: - Nexus OSS 3.67.1-01 на OrientDB - Total co...
Michael Kostelcev
11
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
GM, Oceaners! 🌊 Phase 1 of the ASI token merger begins today at 15:00 UTC! We've been prepping you for this 💪 Remember: 1. DO NOT RUSH! Plenty of time for this merge; Phase ...
Danil | Never DM first Kovtoniuk
8
Hi, I can't understand promises in JavaScript and what we should use them for (maybe the teacher didn't teach well XD). Do you have a solution for this? And are promises used...
A
29
or any website to buy prepaid card with xmr that's not trocador that's down?
Umbrella Party Partner
18
Если у очереди установлено x-message-ttl, при получении сообщения из этой очереди, можно узнать остаток времени жизни сообщения?
Сергей
8
Подскажите как мне лучше держать websocket сединение и переодически передавать в него данные? Сначала я сделал так: for _ in 1...1000 { try? await ws.send("test") try...
Mihail Verenich
2
Ещё такой вопрос. Мне необходимо хранить пароль пользователя локально. Для этого планирую использовать ini файл. Это для автозаполнения полей логин и пароль при авторизации. Е...
Евгений
19
Карта сайта