I think the reason for making words global by default
is simply because it is the natural thing for a newbie
to the language or beginner to use. I think this was
the right decision.. fits with the rebol philosophy..

The "::" solution, i feel, has the benefit of not
getting in the way of beginners but making things more
efficient/less errorprone for the
intermediate/advanced.. 

well - at least it seems that way to me at first
glance...

rishi

>>>
  Yeah. I've been wondering why rebol does that....
  
  Could it be better to make any 'word local by
default,
  and make that word global optionally with a key word
  and maybe another keyword to 'protect it?

  I'm sure there is a good reason for the current
  approach, but I don't know what it is.
   -tim-
<<<
--- Rishi Oswal <[EMAIL PROTECTED]> wrote:
> One part of REBOL that can feel odd is when i have
> to
> define local variables of a function in the first
> block of the function. I find it a bit annoying to
> have to add new variables to the list for every
> little
> local variable I use. In addition, I  feel it
> clutters
> up the first block and increases function size. In
> addition, the way it is currently done could make it
> easy to create hard to detect bugs.
> 
> What I would like to see is another shortcut to
> creating local variables in any context (function,
> innerfunction, loop). The obvious way I see of doing
> this is as follows:
> 
> 
> myfunc: func [][
>   localvar:: $25
>   myinnerfunc: func [][
>     innerlocal:: $10
>     print localvar ; prints $25
>   ]
>   print innerlocal; error!
> ]
> print localvar ; error!
> 
> using the "::" for local var will make it more
> convienient to create local vars (which i use all
> the
> time over global vars). In addition, it will help
> prevent some errors of accidental global var
> creation
> because it is now easy to spot a local var. Best of
> all, this type of shortcut would not break anything
> in
> rebol. You could even use this in a loop:
> 
> for count 1 10 1 [
>   localvar:: "hello"
> ]
> 
> Using the "::" shortcut in a global context would be
> the same as using a ":". 
> 
> The disadvantage I see is that it adds another thing
> to the language.. But consider that now we could
> stop
> using the /local keyword, reduce bugs, and use it
> consistently everywhere, overall it can simplify
> things.
> 
> Anybody have other reasons as to why it was not done
> this way??
> 
> Perhaps there is a performance issue??
> 
> rishi
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/
> -- 
> To unsubscribe from this list, please send an email
> to
> [EMAIL PROTECTED] with "unsubscribe" in the 
> subject, without the quotes.
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to