Re: how to call blocks?
Jeremy Tregunna <[email protected]> Wed, 08 Aug 2012 16:20:52 -0600
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <[email protected]> |
Blocks aren't activatable by default, therefore you need to pass a "call" message to them. I.e., in your example, call v like this:
v call
If you make blocks activatable, by sending the setIsActivatable(true) message to them such like this:
v b := block("block println") setIsActivatable(true)
Or at any point in their life, from that point on they can be called just like methods; by name.
Regards,
Jeremy Tregunna
On Wednesday, 8 August, 2012 at 12:15 PM, shifeng_h wrote:
>
> hi, I am a new guy for Io language. and I have a problem need help.
>
> after I create a block with method block(), how to invoke it? the code below didn't work.
>
> thanks for help
>
> Io 20110905
> Io> v := Object clone
> ==> Object_0x15f8b60:
>
> Io> v b := block("block" println)
> ==> method(
> "block" println
> )
> Io> v b
> ==> method(
> "block" println
> )
> Io>
>
>