Re: [PATCH] Making in_array a language operator
2011/11/13 Antoine Delignat-Lavaud <[email protected]>:
> On Sun, 2011-11-13 at 03:10 +0100, Johannes Schlüter wrote:
please use two replies next time :)
> On Sun, 2011-11-13 at 14:23 +0100, Pierre Joye wrote:
>>
>> There is an idea to have pseudo object for common types, where these
>> functions would be callable without actually having an instance. No
>> implementation yet so far.
>
> So this means being able to use $string->strlen() (or even $string->len())
> instead of strlen($string) or $array->in_array($x) ($array->in($x)) instead
> of in_array($x,$array), right?
Yes, that's the idea, but then with obvious names:
$string->length(); or $string->length;
$array->in($x);
instead of reusing the horrible string functions we have right now
(needle haystack orders and other (impossible to remember) funny
things ;).
> That seems like a step in the right direction, with no change to the syntax
> required. I'll try to see if I can make an implementation of this but I fear
> it might be a bit more complex than just new language constructors.
It is definitively more tricky yes.
Cheers.
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
Thread (9 messages)