Local variables and COMPILE,
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
Local variables and COMPILE,         


Author: Andrew Haley
Date: Sep 9, 2008 03:12

Is it legal to use FIND on the name of a local variable to return xt
and then pass the xt to COMPILE, ? It doesn't seem to be forbiddedn
so I'm guessing this is OK.

Andrew.
4 Comments
Re: Local variables and COMPILE,         


Author: Jonah Thomas
Date: Sep 9, 2008 04:12

Andrew Haley wrote:
> Is it legal to use FIND on the name of a local variable to return xt
> and then pass the xt to COMPILE, ? It doesn't seem to be forbiddedn
> so I'm guessing this is OK.

No, it isn't OK.

13.3.3.2 Syntax restrictions

e) Words that return execution tokens, such as ' (tick), ['], or FIND,
shall not be used with local names;
no comments
Re: Local variables and COMPILE,         


Author: Andrew Haley
Date: Sep 9, 2008 06:19

Jonah Thomas gmail.com> wrote:
> Andrew Haley wrote:
>> Is it legal to use FIND on the name of a local variable to return xt
>> and then pass the xt to COMPILE, ? It doesn't seem to be forbiddedn
>> so I'm guessing this is OK.
> No, it isn't OK.
> 13.3.3.2 Syntax restrictions
> e) Words that return execution tokens, such as ' (tick), ['], or FIND,
> shall not be used with local names;

OK, thanks.

Andrew.
no comments
Re: Local variables and COMPILE,         


Author: Elizabeth D Rather
Date: Sep 9, 2008 10:12

Andrew Haley wrote:
> Is it legal to use FIND on the name of a local variable to return xt
> and then pass the xt to COMPILE, ? It doesn't seem to be forbiddedn
> so I'm guessing this is OK.
>
> Andrew.
>

Where would you do this? The local exists only within the scope of the
definition in which it's created, so you'd have to do whatever between a
] and [ and it all sounds very messy. Hard to imagine a context in
which this would be a good idea, which is probably why it isn't
explicitly forbidden. There's also, I suspect, no guarantee that it
would work.

Cheers,
Elizabeth
Show full article (0.96Kb)
no comments
Re: Local variables and COMPILE,         


Author: Andrew Haley
Date: Sep 9, 2008 12:10

Elizabeth D Rather forth.com> wrote:
> Andrew Haley wrote:
>> Is it legal to use FIND on the name of a local variable to return xt
>> and then pass the xt to COMPILE, ? It doesn't seem to be forbiddedn
>> so I'm guessing this is OK.
> Where would you do this? The local exists only within the scope of the
> definition in which it's created, so you'd have to do whatever between a
> ] and [

Or an immediate word...
> and it all sounds very messy. Hard to imagine a context in which
> this would be a good idea,

Hah! I'll refer you to my not-yet-presented slides for EuroForth,
when all will become clear. :-)

Andrew.
no comments