Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58429 invoked from network); 17 Jul 2012 15:21:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2012 15:21:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.160.42 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:37619] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/80-54353-11385005 for ; Tue, 17 Jul 2012 11:21:54 -0400 Received: by pbbrp12 with SMTP id rp12so997566pbb.29 for ; Tue, 17 Jul 2012 08:21:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=k92+Itskr4Tv5j3y/94F7iHNCYtisujAQc0O3giutkU=; b=B6umti6NucQdo11rx+340dIp4Ufyvq6kGnCACoLU/4xEwlmxtkp831ZIsOVqAuUsCg VRLeSR7wpxALCGM+o4hgTZsP/D8elPoApive9+LJ/HaoBR7yyMUge2dFcHAeTygB4MHN lySHh8nhi24Yalg4O7MJ+kDZ/7bCcXYlMu5gFNAmAFEqqB8hOJnZul9GvKghwG5ZT02Y bDnH1o3QHYs3+H3AxErXemxH5az9Xgbb7oIFFj7hwih/oiiBWkoxTjLpLZhFVLuc0fFU XHiNTnaIkFmkZtrkb75xeG7c5T8NhSKrKGBQ+m52eORbmRD27QlbVSi2+G4wVAk3c96v n4nA== Received: by 10.68.232.232 with SMTP id tr8mr7247949pbc.73.1342538511356; Tue, 17 Jul 2012 08:21:51 -0700 (PDT) Received: from [192.168.200.5] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPS id qi8sm14219860pbc.36.2012.07.17.08.21.49 (version=SSLv3 cipher=OTHER); Tue, 17 Jul 2012 08:21:50 -0700 (PDT) Message-ID: <5005830C.3000709@lerdorf.com> Date: Tue, 17 Jul 2012 08:21:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Andrew Faulds CC: Pierre Joye , internals , Gustavo Lopes References: <500570D1.9050708@lerdorf.com> In-Reply-To: X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlXl97/rdlyZD9IpxBX90kpv/XATwnBpvmyxCBTA8EUwzWZUJmiakwUeYi2ePO9pChmiTQj Subject: Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.) From: rasmus@lerdorf.com (Rasmus Lerdorf) On 07/17/2012 08:06 AM, Andrew Faulds wrote: > Whilst weak typing has its benefits, I think typing is a little too weak > in places. IMO "" should not be equal to 0 or coercable to 0. But of > course "0" should equal 0. Which has nothing to do with this thread. > > On Jul 17, 2012 3:04 PM, "Rasmus Lerdorf" > wrote: > > On 07/17/2012 03:07 AM, Pierre Joye wrote: > > hi, > > > > On Tue, Jul 17, 2012 at 2:12 AM, Gustavo Lopes > > 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 >