|
Am 16.04.2014 10:22 schröbte steve donovan:
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.
I'm not sure the extra table lookup matters when you use pattern matching (maybe for `char`, `byte`, et al.) ... I do it if I think that someone will monkey-patch the string library behind my back, and that is pretty likely as soon as sandboxes are involved ...
But yes, I've seen string methods used a lot in other people's code.What I wonder though: If people would have been aware of the problems of using global shared objects from the beginning, would string method syntax be as popular as it is now?
We probably should just implement a ready-to-use sandboxing module with separate processes and rlimits (or equivalents for other OSes), in which case removing the string metatable (or the debug module) would become superfluous anyway ...
Philipp