RE: New "cut" operator (was: Pike 8.0 RC1)
郭雪松 <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
> string cutfront(string text, string divisor)
If pike allows me write code like this:
"<some thing>"->cutfront(">")
I would think cutfront is ok. object oriented you know, the object was always come out first.
Guo Xue Song
> Date: Sun, 16 Nov 2014 14:40:39 +0100
> Subject: Re: New "cut" operator (was: Pike 8.0 RC1)
> From: [email protected]
> To: [email protected]
> CC: [email protected]
>
> On Sun, Nov 16, 2014 at 12:50 AM, 郭雪松 <[email protected]> wrote:
> > new operator feature sugest:
> >
> > ("cut left example"<<" ")=="left example"
> > ("cut left example">>"ex")=="cut left "
>
> NAK. It's a very specific and unobvious use of an operator that
> conflict both with both the (unfortunately) adopted C++ iostream
> syntax and the more obvious mathematical "much greater|lesser than".
>
> It looks sort of useful but would do well as a functions to make sure
> the code is readable. Something like this:
>
> string cutback(string text, string divisor)
> {
> return (text/divisor)[1..]*divisor;
> }
>
> string cutfront(string text, string divisor)
> {
> return (text/divisor)[0];
> }
>
> With better names if possible.
>
> --
> Peter Bortas
>