Re: Pseudo-objects (methods on arrays, strings, etc.)

From: Date: Tue, 17 Jul 2012 14:04:01 +0000
Subject: Re: Pseudo-objects (methods on arrays, strings, etc.)
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-61350@lists.php.net to get a copy of this message
On 07/17/2012 03:07 AM, Pierre Joye wrote: > hi, > > On Tue, Jul 17, 2012 at 2:12 AM, Gustavo Lopes <glopes@nebm.ist.utl.pt> wrote: > >> Let's ignore empty arguments like "make[s] PHP feel modern". That aside, the >> main argument advanced in this message makes no sense. > > This idea has been proposed many times in the past and it is actually > a very good proposal, for array, string or other types. > > The only reason why it is not yet implemented is the technical > complexity to do it. We need pseudo objects and the likes, and it is > really not something easy to do, in an efficient enough way. And also because most of the proposals are simply strong-typing in disguise. If you turn scalars into objects and attach methods to those objects are you still going to be able to call floor() on a numeric string? This isn't as simple as people think on first glance and it doesn't really clean up the global namespace since we still need to be able to do type coercion which effectly implies that all scalar objects need to include the bulk of the current set of scalar functions. -Rasmus

« previous php.internals (#61350) next »