lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2014-04-19 10:20 GMT+02:00 Philipp Janda <siffiejoe@gmx.net>:
> Am 19.04.2014 09:47 schröbte Dirk Laurie:
>> The proposal allows for customizable character classes. We already
>> have that. Nothing (except the vast effort of actually doing it) stops you
>> from defining your own locale ...
> Do you think that locales were a good idea? We inherited those from C but
> there's no reason to make the same mistake again just because C made it
> decades ago.

Whether they are a good idea or not, they are there, accessible from
Lua. And if they are there, somebody will use them.

You come from a country (I guess) where people would expect
string.upper"über" to come out as "ÜBER". Is that such a very bad idea?

> They are hidden and they remain hidden, you just add another layer.
> Maybe those configurable character classes are better left to something like
> LPeg where you can pass them around explicitly.

I really love LPeg and use it whenever the string library is irksome.
But it is much harder to learn (I wrote beginner's notes for it [1], to which
I find myself still returning occasionally.) and even though Roberto has
toyed with the idea of putting it in Lua [2] it has made no appearance in
5.3 yet.

My proposal was made in the context of Hisham's UTF8-enabled string
library. Let me put it this way: if you are going to all the trouble of writing
something that can handle as a single logical entity a multibyte sequence
which matches utf8.charpatt, why not do it in such a way that one can
slot in other patterns too?