lua-users home
lua-l archive

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


Am 19.04.2014 08:13 schröbte Dirk Laurie:

Suppose the string library had a function `string.defineclass`.

string.defineclass("%u",utf8.charpatt)
stdin:1: attempt to redefine a built-in character class
string.defineclass("%Z",utf8.charpatt)
stdin:1: bad argument #1 to 'defineclass' (must be lowercase)
string.defineclass("%z",utf8.charpatt) -- then do some great stuff with %z and %Z
string.defineclass("%z",nil) -- %z and %Z not available anymore

What could be allowed as second argument (string, table, function?)
will come out during implementation.

If the proposed "text" mode could be implemented on top of
that, we will have gained a lot more.

Unless I miss something, it seems the `defineclass` function is supposed to modify some global state in the pattern matching engine. I thought we agreed by now that this is a bad idea ...




Philipp