@back2dos Now that I see your example, emulating javascript’s typeof
(when used by TypeScript
to extract a type from structures) is exactly what I wanted, so thanks a bunch for this! This is actually better than automagically generating types like I asked for originally.
A couple of follow-up questions:
- This is a quite useful heper and I actually would expect this to be part of the
Type
class instd
. Do you know why it’s not part ofstd
? Could we have it as part of the std lib ortink_*
? cc @nadako; - Why is the square-brackets syntax needed there (i.e
<[foo]>
instead of<foo>
)?; - Why are you using
TInst
there? The docs say it represents an instance of a class, but unless I’m missing something, we’re not passing an instance there in the type param, or are we? - Could you explain this syntax
TInst(_, [TInst(_.get().kind => KExpr(v), _)])
, specifically the=>
. Also, where does_
come from, from the first assignment inTInst(_ <-- here
?;
And regarding our shiny new community - is this type of question better suited for StackOverflow
? cc @jdonaldson (I just saw a discussion about this here).
Thanks again!