Hi all,

when trying to evaluate the following snippet in jolt

(let ((selector 'justTesting)) 
  (add-method object1 'testMethod
    (lambda (_closure _self self) 
        (send 'println: StdOut selector))))

I get an error that "selector is undefined".
Apparently, the problem is that I'm using "selector" in a lambda's body, while 
its definition is outside. Indeed, if I just move the (let) inside the lambda 
body, it works:

  (add-method object1 'testMethod
    (lambda (_closure _self self) 
      (let ((selector 'justTesting)) 
        (send 'println: StdOut selector))))

I'm wondering, though, if I can get things to work the first way? Aren't 
lambda's supposed to be closures, so that they can actually access variables 
defined in lexical scope? Or is there anything I could do with the _closure 
parameter here (what is it for, anyway...)?

Thanks in advance,

Hans

-- 
If we cannot live so as to be happy, let us at least live so as to deserve it
 -- Immanuel Hermann Fichte

A liberal is a person whose interests aren't at stake at the moment
 -- Willis Player

Ark Linux - Linux for the Masses (http://arklinux.org)

Hans Schippers
Aspirant FWO - Vlaanderen
Formal Techniques in Software Engineering (FoTS)
University of Antwerp
Middelheimlaan 1
2020 Antwerpen - Belgium
Phone: +32 3 265 38 71
Fax: +32 3 265 37 77
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to