We can have more consistent naming, at least. I like this idea even more now, it means we could have a set of universal operations:
$bool->negate(); // true -> false $num->negate(); // 7 -> -7 $numericString->negate(); // "123" -> -123 $float->negate(); // 3.141592 -> -3.141592 $customVectorType->negate(); // (1, 0.5, -1) -> (-1, -0.5, 1) //etc. negate(); is just an example: that's usually done with an operator, I'm really thinking more of things like sort() here. But you get the idea. On Jul 19, 2012 4:50 PM, "Rasmus Lerdorf" <ras...@lerdorf.com> wrote: > On 07/19/2012 12:25 AM, Pierre Joye wrote: > > hi Rasmus, > > > > On Wed, Jul 18, 2012 at 8:49 PM, Rasmus Lerdorf <ras...@lerdorf.com> > wrote: > > > >> This makes no sense to me either. How does it let us clean the APIs? Can > >> you give an example? I have one: > >> > >> $a = -5; > >> $b = "-5"; > >> > >> echo $a->abs(); // Outputs 5 > >> echo $b->abs(); // should still output 5 > >> > >> What has been cleaned here over: > >> > >> echo abs($a); > >> echo abs($b); > > > > Heh, here is another example where it makes even less sense: time(); > > > > sigh. > > > > More seriously... we are not talking about these APIs and I am sure > > you know which one I refer to, like the string API and the like. > > Ok, so for the string API: > > $a = 1; > $a->strstr('1'); > > should still work. All the string API methods need to be available on > every pseudo-object regardless of the type. So I don't see any "cleanup" > here either. > > -Rasmus > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >