You really define a function for every single call site of the method? Every each call in the whole Crystal stdlib and user’s code creates a distinct each method?
As far as I’m aware, yes.
Was that out pseudo-code for closured variables? What happens with self ?
Yes, consider that very pseudo code, I don’t think there’s valid Crystal code to emulate what really happens :) I just meant to indicate that __t is the callside’s t. You can imagine the generated method somehow has full access to the callsite’s scope, in the case of a closuring block anyways.
So I went full circle. First, I imagined literal block inlining. Since blocks are generally different, the obvious meaning of “inlining” made no sense, and then the examples in the reference made me think it was the method being inlined. So, I am back at “each call site invokes a copy of the original method with the block inlined and closured vars, constants, self, etc. working as expected”, whatever that technically really translates to.
It took me a lot of time to realize it as I could not understand at that moment why local block variables was not shown in debugger and why crystal had a bug with methods with blocks when he was jumping somewhere in the local file instead of going into the file that contains the source code for that method.
Some bits and pieces from @asterite helped me to click all pieces to the whole picture.