Re: Re: String extension proposal

From: Date: Tue, 10 Jun 2008 22:03:46 +0000
Subject: Re: Re: String extension proposal
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-5496@lists.php.net to get a copy of this message
Hi Francois, I really like those ideas alot, I think they're even closer to the core (arguably where they belong), but probably more difficult to consider for a language already in use so widely. I know these are really radical changes, but I'm really glad there is some support for this (albeit none yet from the people in charge). I think many users of the language would love some of these proposals. Regards, Mark On Tue, Jun 10, 2008 at 9:38 PM, Francois Laupretre <flconseil@yahoo.fr> wrote: >> De : Joe Stump [mailto:joe@joestump.net] >> >> as a smart man once said, "I disapprove of what you say >> (code), but I will defend to the death your right to say (code) it." ;) > > +1 > >> I for one would love a unified OO interface for both strings and >> arrays as I find them to be more concise. A good example of what I'm >> looking for would be: >> >> $arr = new array('foo'); >> $foo = $arr->pop(); > > Defining String & Array classes is interesting but it would be much better > if these objects could remain compatible with native strings and arrays. > > Combining this with a smart use of return_value_used, it would give > something like : > > $arr=array(' FOO ','bar'); > > $a2=$arr->reverse(); // $arr is not modified, The reversed array is > returned. > > $arr->reverse(); // $arr is reversed in place > > $s=$arr->pop(); // returns ' FOO ' > > $s2=$s->trim()->tolower(); // returns 'foo' > > $s->trim(); // $s becomes 'FOO' > > I know it cannot be done as an extension to the current core and implies a > mechanism allowing to consider native types as objects (at least to call > methods). > > Please don't reply that it's too complex ot that I'd rather use > python/java/cobol(just kidding)... > > Regards > > Francois > >

« previous php.pecl.dev (#5496) next »