* Larry Wall <la...@wall.org> [2009-01-12 21:55]:
> * Aristotle Pagaltzis <pagalt...@gmx.de> [2009-01-12 21:20]:
> > Plus if there are separate `.ltrim` and `.rtrim` functions it
> > would be better to implement `.trim` by calling them rather
> > than vice versa, so it wouldn’t even be less efficient two
> > make two calls rather than a parametrised one.
> Depends on your string implementation if they're
> non-destructive, since they potentially have to copy the middle
> of the string twice if your implementation can't support one
> string pointing into the middle of another. And again, I think
> .trim should be non-destructive, and .=trim should be the
> destructive version.

Sure, but that doesn’t affect my point: if `.trim` is implemented
as calling `.ltrim` + `.rtrim`, as I assumed, then all ways of
trimming a string at both ends will be equally efficient or
inefficient depending on whether or not the implementation
supports offsetted strings.

Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to