Stream: beginners

Topic: ✔ Runtime reflection


view this post on Zulip hchac (Mar 03 2025 at 14:33):

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: )

view this post on Zulip Anton (Mar 03 2025 at 14:49):

Hi @hchac,
This is not possible in current Roc and is not planned.

view this post on Zulip Notification Bot (Mar 03 2025 at 14:53):

hchac has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC