[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: suggestion for backwards compatible "global"
- From: "Tom " <tmb@...>
- Date: Fri, 15 Sep 2000 21:35:09 -0000
The problem with that kind of approach is that either
the default is still the error-prone behavior, or the
change isn't backwards compatible.
To maintain backwards compatibility, the behavior of "function"
cannot be affected. And to make the safer semantics widely
used by default, its use has to be at least as simple as
the use of an existing "function".
Perl roughly took the approach you suggest, leaving the
old semantics in place and adding new features for declaring
safety. Even today many scripts don't use it because it's
easier to leave the stuff out. And with the Perl redesign,
Perl will probably have to address this issue yet again
(they are probably just going to break backwards compatibility
this time around).
I do consider having two keywords for declaring functions a
kind of a wart. But as languages mature, those kinds of things
happen, and I think this change would actually be quite benign.
And maybe uses of the old variety would simply die out quickly,
in particular if the documentation uses the new syntax for
--- In email@example.com, "Magnus Lie Hetland" <mlh@i...> wrote:
> ----- Original Message -----
> From: Russell Y. Webb <rw20@c...>
> To: Multiple recipients of list <lua-l@t...>
> Sent: Friday, September 15, 2000 6:28 PM
> Subject: Re: suggestion for backwards compatible "global"
> > Good idea! I suggested it about 2 years ago and didn't get
> > it. Perhaps times have changed...
> > I believe my suggestion was to use "method" or "routine" as the
> > there doesn't seem to be an entirely satisfying word available
> If we are to allow both sematics and mark the difference with a
> or something of the sort, it seems much cleaner to me to simply
> the "local" syntax. One could for instance say that
> local *
> means that all assignments are local (perhaps except the onse
> For instance:
> function f (x)
> local *
> y = x*2
> print y
> would print out 1, 4 and 1... If one wanted to add a keyword (which
> undesirable) one could perhaps write "local all" or something, which
> be prettier IMO... Although probably unacceptable...
> Anyway... I must say that personally I would favour having the
> local with only the "global" keyword available... Guess I'm just
used to it
> Magnus Lie Hetland (magnus at hetland dot org)
> "Reality is what refuses to disappear when you stop
> believing in it" -- Philip K. Dick