Hello,
Is there currently (or planned) some form of runtime reflection?
Let's say I have some function that takes in a completely open record:
dynamic_serialize : {}* -> Result Str [MissingFields]
In this dynamic_serialize, it will check at runtime for a dynamic set of fields in the record: ["one", "two", "three"] (fields come from outside the program) and verify that the fields have a type of let's say Str or {} -> Str (just example). It will then fetch this fields from the record dynamically to produce the Result.
Is this possible? (and let's say we're also ignoring the question of whether this is sane :sweat_smile: )
Hi @hchac,
This is not possible in current Roc and is not planned.
hchac has marked this topic as resolved.
Last updated: Nov 09 2025 at 12:14 UTC