curiousity: evaluation of block vs. method
"McCarrell, Jeff" <[email protected]>
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <CA1FC5CC.3170%[email protected]> |
Hey everyone. I have been getting to know Io; trying to work out the evaluation rules, especially the difference between a block and a method.
I understand the lexical vs. dynamic binding of variables aspect.
I have read that blocks and methods are mostly the same.
However, there is an aspect of the evaluation rules I am not following.
I would expect this code:
b := block(n,
"in b" println)
b type println
m := method(n,
"in m" println)
m type println
to produce
Block
Method
or perhaps:
Block
Block
Instead, it produces:
Io> doFile("curiousity.io")
Block
in m
Sequence
So it appears that in evaluating:
b type println
b (a block) is not evaluated. This is what I expect. However, for m, a method, it appears m is evaluated, as shown by the "in m" output, and the return type.
This puzzles me.
Asking the Lobby for the named slots back produces more expected results:
Io> Lobby getSlot("m") type
==> Block
Io> Lobby getSlot("b") type
==> Block
So why does evaluating m and b differ so much?
Thanks,
-- jeff