Re: [PATCH] Add .trim method

[email protected] (Geoffrey Broadwell) Mon, 12 Jan 2009 09:33:32 -0800
Newsgroups perl.perl6.language,perl.perl6.internals
Message-ID <[email protected]>
On Mon, 2009-01-12 at 07:01 -0800, Ovid wrote:
> ----- Original Message ----
> 
> 
> > > > I could optionally make the following work:
> > > >
> > > >  $string.trim(:leading<0>);
> > > >  $string.trim(:trailing<0>);
> 
> Alternatively, those could be ltrim() and rtrim().  If you need to dynamically determine what you're going to trim, you'd couldn't just set variables to do it, though. You'd have to figure out which methods to call.  Or all could be allowed and $string.trim(:leading<0>) could all $string.rtrim internally.

When I saw your proposed syntax above, instead of reading "don't trim
leading/trailing whitespace", I read "change the definition of
'whitespace' to 'codepoint 0' for leading/trailing".

That of course raises the question of how one *would* properly override
trim's concept of whitespace ....


-'f