Stream: ideas

Topic: tagName builtin


view this post on Zulip Travis (Oct 12 2022 at 15:43):

rather than having to do a manual switch over some Tag, and map to strings, it would be nice if there was builtin that did this. this could possibly make printing error messages a lot easier. zig's @tagName has made me want this feature.

view this post on Zulip Travis (Oct 12 2022 at 15:45):

i know it only works for enums and tagged unions (not for extern unions or untagged unions) in zig.

view this post on Zulip Travis (Oct 12 2022 at 15:46):

not sure if roc has any of these considerations and whether the compiler could easily output the tags as strings.

view this post on Zulip Ayaz Hafiz (Oct 12 2022 at 15:47):

We've talked about abilities similar to Display/Debug in Roc that would automatically print a string representation of a type, that would serve this purpose well.


Last updated: Jun 16 2026 at 16:19 UTC