# Question, how do I essentially "register" all calls that somebody does, store # them somewhere and then generate an object variant out of it? # Basically the code in my head would do something like this: # Source code type Message1 = object name: string type Message2 = object register("route1", Message1) register("otherRoute", Message2) generate() # Generates object variant: type MessageKind = enum route1, otherRoute type Message = object case kind: MessageKind: of route1: route1Msg: Message1 of otherRoute: otherRouteMsg: Message2