backquote and scope. #2611
-
|
Good Afternoon, I'm wondering about the ` semantics in Medley. My question is this, what scope do functions created with it have?
That appears to turn into a List of I've used this for my recent project and it seems be be working really well. Sorry to beat a dead horse around closures. Sincerely, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
For IRM backquote documentation, you can As for which The ` readmacro, just expands as the form wrapped in (QUOTE `(lambda () (frobulate ,FOO-INSTANCE )))expands to: (IL:BQUOTE (LAMBDA NIL (FROBULATE (IL:\\\, FOO-INSTANCE))))(In an Interlisp EXEC, the That ultimately expands to the code to construct the appropriate form: (LIST 'LAMBDA NIL (LIST 'FROBULATE FOO-INSTANCE))The scope is determined as if the code to construct had been manually entered in the surrounding code. |
Beta Was this translation helpful? Give feedback.
-
|
Ah OK, thanks @MattHeffron . I was looking for it in the Function Evaluation part of the IRM where QUOTE and friends are listed, I see it's in the Read Macro section. |
Beta Was this translation helpful? Give feedback.
-
|
IL:LAMBDA is an Interlisp-style LAMBDA -- arguments are NIL, a single symbol, a list of symbols. CL:LAMBDA also implies that evaluation follows CL:EVAL while IL:LAMBDA follows IL:EVAL. (I think!) CL:LAMBDA is common lisp style, with &KEY, &ALLOW-OTHER-KEYS, &OPTIONAL keywords, default values. IL:LAMBDA can be translated into CL:LAMBDA by
|
Beta Was this translation helpful? Give feedback.
For IRM backquote documentation, you can
MAN BQUOTEto get the entry in DInfo, or search forbackquotein the IRMAs for which
LAMBDAis used, that's not something that's determined by backquote processing, it was determined when the form was read.The ` readmacro, just expands as the form wrapped in
IL:BQUOTE, with the,,,@, etc. converted to a slightly different IL: litatom.I.e., your example, entered into the XCL-EXEC:
expands to:
(In an Interlisp EXEC, the
IL:\\\,is just\,. The extra\are just for XCL readtable special character quoting in the litatom's p-name.)That ulti…