* Nicholas Clark <[email protected]> [2009-01-24 15:00]:
> But personally I feel that the added conceptual complexity of
> having over-ridable regexps, and in particular .ltrim and
> .rtrim methods with over-ridable regexps is not worth it.
Yeah. I have come around to this view as well.
In programming, everything we do is a special case of
something more general – and often we know it too quickly.
—Alan J. Perlis
I think this is a case of us overgeneralising `.trim` when
perfectly appropriate truly general ways of achieving the same
effect already exist – ie. `.subst`. The reason to have `.trim`
at all is that the use of `.subst` is awkward for the very common
case of wanting to trim both ends. But wanting to trim only a
single side is much rarer while simultaneously not being
appreciably awkward to do with `.subst`. (It’s more typing, but
not enough to matter for such a relatively rare thing.) Sticking
to a single common use-case eliminates the need for configuration
API, improving usability as a whole. Keep it simple.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>