Question about the gen struct. We need it, because, as of now , function definitions are not expressions (so you can't write return { .nextFn = fn () {} }) ?
And it looks like the gen struct is created once for every invocation of the Interface's init.
Where is then, the nextImpl fn located. Is it in the stack (as it is returned as a part of the stack) or is it part of the .text section (as it is executable) and in which case gen is a struct with an embedded functionpointer ?
For further actions, you may consider blocking this person and/or reporting abuse
Great article @kilianvounckx .
Question about the
gen
struct. We need it, because, as of now , function definitions are not expressions (so you can't writereturn { .nextFn = fn () {} }
) ?And it looks like the
gen
struct is created once for every invocation of the Interface'sinit
.Where is then, the
nextImpl
fn located. Is it in the stack (as it is returned as a part of the stack) or is it part of the.text
section (as it is executable) and in which casegen
is a struct with an embedded functionpointer ?