[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Table dot number?
- From: Ben Kelly <ranavin@...>
- Date: Mon, 31 Oct 2011 21:23:18 -0400
On Sat, 29 Oct 2011 22:52:08 -0500
David Hollander <firstname.lastname@example.org> wrote:
> > In my case, it was to allow illegal characters in a function name,
> > such as ["Check?"]. I did similar once to allow @ and $ in
> > identifier names,
> If Lua doesn't mind taking a page from Scheme\LISP, and allowing non
> syntax characters in function names, "?" and "!" are quite useful as
> suffixes. Even if the number of builtin syntactical operators are
> expanded in the future, one could patch their code with a quick grep.
I'm very much a fan of this, and realistically, I don't see much reason
to restrict identifiers to only (%a%w+) as long as the lexis remains
unambiguous. Lisp can probably get away with a bit more than Lua can in
this area (since it doesn't really distinguish between identifiers,
operators, etc), but there's no technical reason why lua couldn't
permit ?, !, ∀, and so forth. (Allowing - is probably too
problematic, though, given that it makes 'foo-bar' ambiguous.)
I do think that the 5.0 approach of allowing "anything in the alnum
category in the current locale" in identifiers was a bad idea, though.
Making the validity of source code dependent on the current system
locale is way too much of a headache.
> I suppose there could be a readability counter argument, as Python
> currently also disallows ! and ? in names.
Conversely, I find judicious use of punctuation in variable and
function names to be a great readability aid! There have also been a
few programs I've worked on recently where the ability to use greek
letters and/or mathematical quantifiers would have made it much more
readable in the problem domain.