Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61350 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40193 invoked from network); 17 Jul 2012 14:04:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2012 14:04:07 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; 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:53599] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/77-28715-6D075005 for ; Tue, 17 Jul 2012 10:04:07 -0400 Received: by pbbrp12 with SMTP id rp12so885655pbb.29 for ; Tue, 17 Jul 2012 07:04:03 -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=27pVeflBXhbAiwo6z23ywKqsuwEQQbJ85BW89SDT23w=; b=T3nSWy54FBC0N/YydCKgDxi2l2/C9i8tWKhF1gD/bq5fsPHZgk8w5i0XGkOq4PlGxR MroU+QbcA+h16ZfCgTQmLrjg+c3AtaOrnQdPxq1Ajlduti0+xHWobCBEyZyRPDq5G3H7 btLEciQM6LgaHVyPHGtj2bouI77dy0QhDW0nSFcJI66Zcdb8pGzeCgSOGOl8YiFhQK06 BQpEfHOdWozski7GCf2r5zLG74fU9y1zdrBk0erDpqzrKpYVi2wH4KiBdgcOBaPHwDBx b0yP2yd34NbMhNYlobXc7v6GWBrMirE9Ae+L5Lze33j9uSTZwk4JsBKWB9poNRY51ArJ eyBA== Received: by 10.68.226.99 with SMTP id rr3mr6743464pbc.48.1342533843697; Tue, 17 Jul 2012 07:04:03 -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 ms1sm14116451pbb.63.2012.07.17.07.04.01 (version=SSLv3 cipher=OTHER); Tue, 17 Jul 2012 07:04:02 -0700 (PDT) Message-ID: <500570D1.9050708@lerdorf.com> Date: Tue, 17 Jul 2012 07:04:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Pierre Joye CC: Gustavo Lopes , internals , Andrew Faulds References: In-Reply-To: X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnuKcJjS9QTcGvhidoOWgWEEhnyJk3hImTB6jtMX9ItY+PjpwcjKHQDP2zVpxaEJ9Zu2vTf Subject: Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.) From: rasmus@lerdorf.com (Rasmus Lerdorf) 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