I've recently seen code like this in two different places:
Code:
%1 %2 %3 %4 %5
NULLLAM #5 NDUPN DOBIND
I was the impression that when using DOBIND, the LAMs had to be quoted like this:
Code:
%1 %2 %3 %4 %5
' NULLLAM #5 NDUPN DOBIND
If you just execute NULLLAM, it appears to push a very small pointer on the stack. Also Chapter 13 of RPLMAN says "Executing an unbound temporary identifier object is
an error condition."
So everything I've seen indicates that one should quote NULLLAM when binding it, but I've run across two cases that don't, and that leads me to wonder if I'm wrong. Can anyone shed some light on this?
Thanks,
Dave
Usually the word before NULLLAM performs a quote.
This can be a combined word like DUP'
(02-19-2014 09:26 PM)David Hayden Wrote: [ -> ]I've recently seen code like this in two different places:
Code:
%1 %2 %3 %4 %5
NULLLAM #5 NDUPN DOBIND
I was the impression that when using DOBIND, the LAMs had to be quoted like this:
Code:
%1 %2 %3 %4 %5
' NULLLAM #5 NDUPN DOBIND
If you just execute NULLLAM, it appears to push a very small pointer on the stack. Also Chapter 13 of RPLMAN says "Executing an unbound temporary identifier object is
an error condition."
So everything I've seen indicates that one should quote NULLLAM when binding it, but I've run across two cases that don't, and that leads me to wonder if I'm wrong. Can anyone shed some light on this?
Thanks,
Dave
Interesting.
The construct you quoted above without the tick is the way I normally do it when I've got more than a couple LAMs to bind. This method is taken directly from page 115 in
the Kalinowski/Dominik SysRPL documentation. In that document, the reference info for the NULLLAM object simply shows it putting NULLLAM on the stack, and not attempting to execute anything. Furthermore, the documentation states that BIND will actually work with
any ROM-pointer on the stack (ie. not just NULLLAM). Though I've never tried anything other than NULLLAM, I have no reason to doubt their assertion.
I've got quite a few SysRPL code objects that use this method, and I've never had any problems binding LAMs that way. I've never seen any evidence that the tick is needed.
Edit: I just took a look at chapter 13 of RPLMAN and noticed (at the bottom of page 60) the following construct:
NULLLAM TWENTYFOUR NDUPN
{}N BIND
Although it uses {}N BIND instead of DOBIND, the preceding commands use the "unticked" NULLLAM as well. This would seem to confirm that no tick is needed.
(02-20-2014 02:03 AM)DavidM Wrote: [ -> ]NULLLAM TWENTYFOUR NDUPN DOBIND
This works because the pointer to the "nullnamed name" object will never be used. It's just a dummy pointer, which will be stored in the appriorate TEMPENV slots associated to the LAMs.