[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jun 25 11:49:24 1993 
Subject:Re: BUG in POP11 
From:Andrew Casson 
Volume-ID:930625.04 

[I'm sure someone else can explain this better, but...]

Helen,

Your problem has nothing to do with macros.

Firstly, remember that if you don't explicitly declare your input locals,
they'll default to "vars", i.e. dynamically scoped variables. Thus your
example is exactly equivalent to

    section $-banana => TAIL;

        define TAIL(L) -> RESULT;
            vars L, RESULT;
            L --> [= ??RESULT] ;
        enddefine;

    endsection;

Now, the -vars- statement plants code by means of -sysVARS-. If you look at
the section on -sysVARS- in REF VMCODE you will see that what this actually
does is to "simultaneously declare and dynamically localise a permanent
variable. In other words, what your code "really" does is this:

    section $-banana => TAIL;

        vars L, RESULT;

        define TAIL(L) -> RESULT;
            dlocal L, RESULT;
            L --> [= ??RESULT] ;
        enddefine;

    endsection;

Now, I hope you can see what the problem is here: -RESULT- is not being
exported from $-banana, therefore you cannot see its value, therefore you get
<undef RESULT>.

I hope this demonstrates that one should *not* jump to the conclusion that
unexpected behaviour that one does not understand must be a "disastrous bug".

Andrew

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Andrew Casson, DAI/AIAI, University of Edinburgh        andrewc@aiai.ed.ac.uk
                                                                 031-650 2751
"Quid fiat si hanc bullam trudeam"                                    or 2705
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=