lua-users home
lua-l archive

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


On Wed, Apr 16, 2014 at 10:12 AM, Philipp Janda <siffiejoe@gmx.net> wrote:
> Depending on the coding style there is not that much convenience involved,
> e.g.:
> `s_gsub( s, "x", "y" )` vs. `s:gsub( "x", "y" )` (three more characters
> including a space).

It's what I would do _when_ I am concerned about performance.  Fact
remains, there are string methods, and sufficiently many people like
them to make their disappearance a great disappointment.

> If your head doesn't hurt yet, imagine your sandboxed code is allowed to use
> coroutines and yield from withing the callback ...
> At this point I would probably just reimplement `b` without method syntax.

That's far too much trouble for a convenience.

It isn't possible for a language to provide every convenience, and
remain sane, lean and fast.  If all strings could have their own
metatable, it would drag down everyone's code for the sake of
something that's really very specialized.  So I remain a fan of PUC
Rio's engineering style - slowly, surely - and ignore fads.