Hi,
On Tue 09 Sep 2008 10:27, "Neil Jerram" <[EMAIL PROTECTED]> writes:
> 2008/9/9 Andy Wingo <[EMAIL PROTECTED]>:
>
>> scheme@(guile-user)> (lambda () (pk a #:bar))
>> $2 = #<program b755ecf8>
>> scheme@(guile-user)> ,x $2
>> Disassembly of #<program b755ecf8>:
>>
>> nargs = 0 nrest = 0 nlocs = 0 nexts = 0
>>
>> Bytecode:
>>
>> 0 (late-variable-ref 0)
>> 2 (late-variable-ref 1)
>> 4 (object-ref 2) ;; #:bar
>> 6 (tail-call 2)
>>
>> Objects:
>>
>> 0 #<variable b80057f0 value: #<program b8005858>>
>> 1 #<variable b7569af0 value: (a . pair)>
>> 2 #:bar
>
> Where in the bytecode is `pk', or some kind of reference to it?
It's object 0:
scheme@(guile-user)> ,x (lambda () (pk a #:bar))
Disassembly of #<program b7fedfc8>:
nargs = 0 nrest = 0 nlocs = 0 nexts = 0
Bytecode:
0 (late-variable-ref 0)
2 (late-variable-ref 1)
4 (object-ref 2) ;; #:bar
6 (tail-call 2)
Objects:
0 pk
1 a
2 #:bar
Sources:
8 #(0 14 #f)
The objects are stored in a vector. When late-variable-ref or -set is
called and the top of the stack is a symbol, it gets looked up and the
resulting variable replaced into where the symbol was. See:
http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=libguile/vm-i-system.c;h=54689116942bc5d5f942ebcc6500e1e9b610e4c9;hb=refs/heads/vm#l262
Andy
--
http://wingolog.org/