Generate type aliases for structures in a class

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

  1. This is a quite useful heper and I actually would expect this to be part of the Type class in std. Do you know why it’s not part of std? Could we have it as part of the std lib or tink_*? :thinking: cc @nadako;
  2. Why is the square-brackets syntax needed there (i.e <[foo]> instead of <foo>)?;
  3. 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?
  4. Could you explain this syntax TInst(_, [TInst(_.get().kind => KExpr(v), _)]), specifically the =>. Also, where does _ come from, from the first assignment in TInst(_ <-- 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!