ietf-mta-filters
[Top] [All Lists]

Re: Variables : list : scope : system : const

2003-05-16 19:56:11

[Nigel Swinson]:

  With regards to "scope" are we definately sure that we want:
  
     All variables have global scope: they are visible until processing
     stops.  Variable names are case insensitive.
  
  Do we want to support any kind of local/file/global scope at all?
  It seems that it's fairly universally agreed that global variables
  are pretty evil (Lawrence has already made this point), so are we
  sure that we want to have all variables global by default?

we need to specify global as default, since an extension changing a
previously file local variable to be global has all kinds of hairy
problems.  I have previously demonstrated that going the other way is
quite easy, since the scope extension itself will have file local
scope.

  Could I suggest that we say that "All variables have file scope:
  they are visible only within the same .siv file, not spanning
  include boundaries".

  Then later we support a "scope" extension that permitted :local
  and :global?

I'm very much opposed to this, since it limits the capabilities of an
INCLUDE quite drastically, with no other workaround than a future
"scope" extension which I think will be useless for anything but
getting a global scope.

  I think the argument for scope is to prevent users from making
  accidental mistakes (rather than adding additional capabilities).
  I'm wondering if a user would "expect" a variable in one script to
  be available to him in the calling script, or in a called script.
  I would imagine the author would expect variables to be local to
  the file by default, but would appreciate a mechanism to
  explicitly ask that a file "bleed" into or out of an included file
  etc.

the expectation of the author will probably vary with what languages
he's used previously.  unless he was brought up on LISP, I believe he
would expect global scope.  (all scripting languages use global scope
by default, so does C and even Pascal.)

-- 
Kjetil T.

<Prev in Thread] Current Thread [Next in Thread>