Blocks
- From: Martin Dobmeier <martin.dobmeier@googlemail.com>
- To: ioke-language@googlegroups.com, users@ioke.kenai.com
- Subject: Blocks
- Date: Thu, 29 Jan 2009 00:13:55 +0100
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=SQlA7E+gWl+GOv79m9xD825jNYac7BdtCxVVBjtyQ1m7k7Y3m7/k/7h7L9xTRKCiDE kZvSGCVRZ0+CwGy1XurEKxqq7Aj87V2rDiIv3unma6OT6rIFTrOztMjZNksRHZoiFkb7 ylThJQGhrEFpbrJMPT75ov+2JR1KuBCP62X1E=
Hi,
I was just going through the updated programming guide (incl. reference guide) again and there're two things that I hope somebody is able to clarify for me ...
The fn() method creates a block that is not activatable, right? As far as I understand that means that you shouldn't be able to call it like a method, but rather activate it by sending the message 'call'. To that end the section on blocks gives the example x = fn(z, z println) and shows that you can invoke it like so: x call(42). But just typing x(42) works as well and evaluates to 42. Shouldn't that be exactly the kinda thing that shouldn't be possible with non-activatable blocks?
Finally, just out of curiosity: The description of the fn() method in the reference guide says that it "creates a new lexical block that can be executed at will, while retaining a reference to the lexical CLOSURE it was created in". Shouldn't that rather be "retaining a reference to the lexical CONTEXT it was created in"? Loosly speaking, I always thought of a closure being a runtime-created "package" that consists of an anonymous code block (or a pointer to that block) and the set of active bindings (the lexical context) at the time the closure is created. Thus my understanding of the inner workings of the fn method was the it does just that: It creates a lexical block (which actually means the kind LexicalBlock) that retains a reference to the context it was created in and both together would be considered the closure.
Thanks for taking the time.
- Martin
|
Blocks |
Martin Dobmeier | 01/28/2009 |
| Ola Bini | 01/29/2009 | |
| Martin Dobmeier | 01/29/2009 | |
| Ola Bini | 01/29/2009 | |
| Martin Dobmeier | 01/30/2009 | |
| Ola Bini | 01/30/2009 | |
| Martin Dobmeier | 01/31/2009 |





