Open zenhack opened 4 years ago
I'd use an intrinsic function like typeId(ApiSession)
, but otherwise I agree this would be very useful.
(Or, another alternative might be to introduce a TypeId
built-in type, which is encoded like UInt64
, but uses type names as its literal values. But that'd be more complicated to implement.)
It's not uncommon to define structs where one of the fields is supposed to be a type id for some other type, but afaik there's currently no way in the schema language to just say "use the id of this type" in a constant definition. This affects Sandstorm's powerbox requests, since if they are generated from schema files they end up looking like this:
Developers shouldn't have to look up and insert the magic constant themselves. Ideally you could just write:
i.e, if a type name is used in a context where a value is expected, treat is as the type id of that name.