Closures

Brian Rice water at tunes.org
Mon Jul 24 07:45:39 PDT 2006


On Jul 22, 2006, at 1:48 PM, Jack Waugh wrote:

> Please explain what kind of a closure a block in Slate can behave  
> as, and what
> other concepts the closure rests on (or is it primitive).  Does it  
> depend on the
> context of execution?

A Closure is a method that closes over a particular lexical  
environment. If you define a method within another method and use  
context from it, it will create a closure. The compiler determines  
this statically right now.

Slate, being a stateful language, has stateful closures, of course:  
changing a binding in the environment that is closed over dynamically  
affects the methods that use it.

The VM also has a special Closure object type to track this, which  
the image is also aware of. Basically it wraps the method. It is not  
like Self's version of FIFO block object model.

There's also not much documentation on this (but see doc/ 
bytecode.txt) because it is an implementation-specific choice.

Honestly, however, your question sounds too vague for me to know  
whether I've answered it.

--
-Brian
http://tunes.org/~water/brice.vcf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /archives/slate/attachments/20060724/a7dcd10d/PGP.pgp


More information about the Slate mailing list