[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Feb 3 13:24:03 1993 
Subject:Re: Re: dlocals etc. (and shallow binding) 
From:Steve Knight 
Volume-ID:930205.01 

Ray Dunn writes on the subject of dynamic binding and the use of
the value of identifiers before they are assigned to:
> Of course not!  But that's the point.  It never was written into the
> manual, so using the "feature" is intrinsically unsafe.  At any time, a
> kind system maintainer could have, with perfect validity, decided to
> initialize the values of locals on function entry to "undef".

Just to clarify for any puzzled readers, this feature is excellently
documented in Poplog and is completely reliable.  Any system
maintainer's doing what Ray suggests would be summarily executed [*].
(The remark may apply to earlier, defunct versions of Pop than POP-11,
of course, and I suspect that Ray is referring to those.)

In POP-11, thanks to John Gibson's excellent insight, shallow binding 
has become a specialisation of the general concept of dynamic localisation, 
supported by POP-11's dlocal construct.  In terms of programming style, 
there is a debate (which Ray goes on to pursue) but Ray's point about 
documentation does not apply to POP-11.

As far as style goes, the use of dlocals for controlling behaviour is
not a nice practice -- and the example of "pr" is very eloquent in
this regard.  There are 6 (or is it 7) dlocals controlling the 
behaviour of -pr- and to use -pr- inside an interrupt requires 
binding all of these!  (And what makes you think that a new one won't
be added at a future date, breaking your code again?)  

Steve

[*] As an act of mercy.