2014-04-19 8:46 GMT+02:00 Philipp Janda <siffiejoe@gmx.net>:
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 ...
For a given meaning of "we"?
I'll confess to agreeing that it is a bad idea to modify built-in functions,
and my examples demonstrate that.
string.defineclass("%u",utf8.charpatt)
stdin:1: attempt to redefine a built-in character class
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, activating it by os.setlocale(), and hey
presto! the character classes %l, %u, %g, %s and maybe other
classes too (the manual only says "and other character groups")
denote whatever you like.