Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth Mac > Re: RfD - Enhan...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 20 of 25 Topic 123 of 158
Post > Topic >>

Re: RfD - Enhanced local variable syntax (long)

by "J Thomas" <jethomas5@[EMAIL PROTECTED] > Aug 22, 2006 at 06:26 AM

Alex McDonald wrote:
> Andreas Kochenburger wrote:

> > I'd prefer that the locals definition must be the first definition
> > within a word, i.e. appear right after : NAME ..
> > This can easily be checked by the compiler.

> It can't be parsed for as it would break a lot of code. It can be
> detected only if { can ascertain that there's been no code generated
> between : and { . Would that not give optimising compilers some
> difficulties?

If you want to check for that, you could have { be something that :
:NONAME and DOES> check. Any other time it doesn't work or gives an
error message.

It wouldn't break code for the standard to say not to define locals
elsewhere -- code which does that would be just as ****table as it is
now. Any implementator who wants to let people define locals elsewhere
could do so. The question is whether it would  be good to require
implementors to allow locals definition elsewhere. And if so, which
places should locals definition be allowed?

Good optimising compilers will put locals in available registers and
will only move them out of the registers when the registers must be
used for something else -- for example a called word that uses locals,
or a word in another task that uses locals.

But less-optimised Forths will tend to put locals on the return stack,
and if they do there's a question what other return-stack uses might
interfere with locals or vice versa. What I remember for that is direct
use of the return stack ( >R etc), loops, and calls. Calls are no
problem, you won't use your locals inside a word you call and the
return stack will be clean when that word returns.

Implementations that call a deeper routine when they switch to compile
state are already nonstandard so that shouldn't be a problem.

: ]FOO      .... local1 ] local2 ....  ;

: TEST [ do-something ]FOO ;  ought to work just fine.
 




 25 Posts in Topic:
RfD - Enhanced local variable syntax (long)
stephenXXX@[EMAIL PROTECT  2006-08-20 20:53:03 
Re: RfD - Enhanced local variable syntax (long)
transfire@[EMAIL PROTECTE  2006-08-20 14:32:47 
Re: RfD - Enhanced local variable syntax (long)
Andreas Kochenburger <  2006-08-21 09:03:46 
Re: RfD - Enhanced local variable syntax (long)
stephenXXX@[EMAIL PROTECT  2006-08-21 11:14:20 
Re: RfD - Enhanced local variable syntax (long)
Andreas Kochenburger <  2006-08-22 08:48:21 
Re: RfD - Enhanced local variable syntax (long)
stephenXXX@[EMAIL PROTECT  2006-08-22 09:07:26 
Re: RfD - Enhanced local variable syntax (long)
"dbu" <dirk@  2006-08-21 01:21:46 
Re: RfD - Enhanced local variable syntax (long)
"Alex McDonald"  2006-08-21 01:28:44 
Re: RfD - Enhanced local variable syntax (long)
"GerryJ" <ge  2006-08-21 06:24:38 
Re: RfD - Enhanced local variable syntax (long)
stephenXXX@[EMAIL PROTECT  2006-08-21 14:20:55 
Re: RfD - Enhanced local variable syntax (long)
Coos Haak <chforth@[EM  2006-08-21 19:30:43 
Re: RfD - Enhanced local variable syntax (long)
"jacko" <jac  2006-08-21 07:58:59 
Re: RfD - Enhanced local variable syntax (long)
"GerryJ" <ge  2006-08-21 14:45:13 
Re: RfD - Enhanced local variable syntax (long)
"Alex McDonald"  2006-08-21 16:04:53 
Re: RfD - Enhanced local variable syntax (long)
stephenXXX@[EMAIL PROTECT  2006-08-22 09:42:48 
Re: RfD - Enhanced local variable syntax (long)
anton@[EMAIL PROTECTED]   2006-08-23 20:35:55 
Re: RfD - Enhanced local variable syntax (long)
Andreas Kochenburger <  2006-08-22 12:21:17 
Re: RfD - Enhanced local variable syntax (long)
Bernd Paysan <bernd.pa  2006-08-20 23:31:42 
Re: RfD - Enhanced local variable syntax (long)
"Alex McDonald"  2006-08-22 05:36:37 
Re: RfD - Enhanced local variable syntax (long)
"J Thomas" <  2006-08-22 06:26:48 
Re: RfD - Enhanced local variable syntax (long)
anton@[EMAIL PROTECTED]   2006-08-23 20:48:39 
Re: RfD - Enhanced local variable syntax (long)
anton@[EMAIL PROTECTED]   2006-08-23 20:58:22 
Re: RfD - Enhanced local variable syntax (long)
"Doug Hoffman"   2006-08-23 17:16:41 
Re: RfD - Enhanced local variable syntax (long)
stephenXXX@[EMAIL PROTECT  2006-08-24 10:44:12 
Re: RfD - Enhanced local variable syntax (long)
dhoffman@[EMAIL PROTECTED  2006-08-25 03:06:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 5:57:42 CDT 2008.