[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: require etc (was Re: globals (_locals))
- From: Reuben Thomas <rrt@...>
- Date: Thu, 7 Jun 2001 10:37:21 +0100 (BST)
> I'm tending to think the same way these days. I view Lua as second-to-none
> in the areas of configuration and embedded scripting. As a "system"
> scripting language however, compared to solutions like Python or Perl, it
> falls short. This is not a negative view of Lua-- I don't think one
> solution could cover all these areas perfectly. Anyway I'm not looking for
> something to replace Python for general scripting on my PC. On the other
> hand Lua has opened up new windows for small apps on big and small systems,
> what Python and the rest could never do.
I agree that it's probably not a good idea to build mechanisms for
everything into Lua (so that it has a module system, an object system &c.).
In this way, Lua resembles Forth: it's easy to roll your own
(meta-mechanisms), people tend to, and for typical applications it's good to
be able to adapt.
However, I do think that to an extent it's possible to have your cake and
eat it: in particular, it's easy to see particular ways of doing things like
OO and modules (as in LTN 7, for example) becoming widely accepted for large
projects and code interchange. It's easy to see libraries of Lua code being
built up (rather than just new C library bindings).
Also, with respect to the other hot issue at the moment, Lua's scoping
rules, I would argue that this is a basic enough issue that a) it should be
settled formally in the language, and b) it can be. (Of course, it already
has been, in the sense of having the global-by-default rule.)
Finally, it's perhaps not too much to hope that in future Lua might extend
its meta-mechanisms to the syntactic domain (where at the moment they're
only semantic, though I realise that keeping a single syntax is also
considered a virtue). This would allow authors to get the compiler to
enforce their per-project conventions for modules, namespaces, OO &c. This
topic has been touched on on the mailing list, but not thrashed out much,
perhaps largely because it's very tricky, but it's certainly worth thinking
about. What mechanisms? What level of customisation? Are we talking about
introducing new basic types and delving deep into the compiler? Or a Lua
equivalent to Scheme's hygienic macros? Or something in between? Can
anything along this spectrum remain consistent with Lua's other aims? &c.
&c. A good solution to this problem would be highly desirable, because it
would make a lot of the other arguments go away: it would be back to "you
can do it like this using the meta-mechanisms", and the solution would give
you the language you wanted, not just the functionality.
http://sc3d.org/rrt/ | Si hoc legere scis nimium eruditionis habes (Anon)