[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Handling deprecated features..? (Re: Lua 5 Grammar update)
- From: Uli Kusterer <witness.of.teachtext@...>
- Date: Thu, 4 Aug 2005 19:58:17 +0200
On Aug 4, 2005, at 19:29:45, Roberto Ierusalimschy wrote:
That seems nice. A simple scheme would be simply a function call
like compatmode5_0() or something like that.
Should it control the "whole" compatibility at once or should it
control different issues independently?
(e.g., compatmode5_0("longstrings") would set compatibility only
for long strings/comments...)
new here, lurked over the past few days, and very impressed with
how smooth Lua works (it compiled out of the box, I just dropped it
in a project file! Wow!), just un-lurking to give my $0.02:
I'd suggest not hard-coding this for 5.0. Maybe do something like
good old ("classic") MacOS had: A Gestalt() function that takes a
selector and returns a value (either a set of flags, or simply a
boolean, or whatever seems appropriate). That way you could ask for a
particular feature. Older versions that don't know a selector could
just return 0. If you want it to be settable, you might want to not
call it Gestalt(), though.
Another approach would be to just declare a built-in list that Lua
itself defines, and from which you can get/on which you can set
certain feature flags. _FEATURES.longstrings = true, or whatever. By
not including the version number in the name, you leave the way open
for being able to add new features to be queried/set in later
releases, and if you decide that a feature that you deprecated for
5.0 should come back in 6.0, you can just keep the option there, even
though it's now there for compatibility with 5.0, not 4.0. You could
also add some more things to query, like the host OS, or even host-
application-specific flags (though you'll want to define a reserved
namespace for built-in, Lua-specific stuff).
What do you think?
-- M. Uli Kusterer