Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61427 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44757 invoked from network); 18 Jul 2012 18:49:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2012 18:49:34 -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.213.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:62003] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/86-39169-D3507005 for ; Wed, 18 Jul 2012 14:49:34 -0400 Received: by yenl12 with SMTP id l12so2209402yen.29 for ; Wed, 18 Jul 2012 11:49:31 -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=m/8Lvys3CzVSsG4z0JF0tV75iXwD1vM1/CMUQ7SG6qU=; b=lO4i29FIF98w2SsmOvJuBLfGxzRrQlKSUU+IEse/358LtuFh2uK89Vee7dneRHlGzF 2Hy0Ip+r2kWj7BL4kYnoJxv7LpXpBkc4DocDUIxqYUcKY1hWfHMN4Mt6gWrI5cigoaCv hqOQq1fwdFcuFNgIz+OaiaQkvOJHX40pApJb9qgOZVtQj7WEG1tHpOzz2LVFiniJfNch mCuXRUDhyx8zc/azePna7kkkpGzhkmHZLjETw+Q13AaWkExceXrN9+leM5KlWKOuT+Dm 1FaG5p76M4w05DI8tw3i5DWiueIA69Y9cCXWddrNYT/jYX0WGSnw5kq/ekd3RRDsNk1L NQwg== Received: by 10.236.186.101 with SMTP id v65mr1936959yhm.23.1342637371123; Wed, 18 Jul 2012 11:49:31 -0700 (PDT) Received: from [172.16.26.30] ([38.106.64.245]) by mx.google.com with ESMTPS id z19sm20404416anh.22.2012.07.18.11.49.29 (version=SSLv3 cipher=OTHER); Wed, 18 Jul 2012 11:49:29 -0700 (PDT) Message-ID: <50070538.10206@lerdorf.com> Date: Wed, 18 Jul 2012 11:49:28 -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: Stas Malyshev , internals References: <50059AF8.5050805@sugarcrm.com> <5005CB58.2020601@sugarcrm.com> <50066724.6050901@sugarcrm.com> 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: ALoCoQmfhd/doKPj0UektryyEBNs9QuKar6yNCZS2Hu32CgbCjvE8pUIi35u9QlRchfc3OOonFQ5 Subject: Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.) From: rasmus@lerdorf.com (Rasmus Lerdorf) On 07/18/2012 01:02 AM, Pierre Joye wrote: > hi, > > On Wed, Jul 18, 2012 at 9:35 AM, Stas Malyshev wrote: >> Hi! >> >>> See the other answers, clear APIs, no more argument mess, cleanness. >> >> Cleanness has nothing to do with pseudo-objects.You don't have to use >> -> to have clean APIs, and using -> doesn't automatically make your APIs >> clean. > > I really do not want to have a semantic discussion here. > > This syntax is sexy, allows us to clean our APIs, and is amazingly handy. 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); other than being 2 characters longer to type? It's not like you can remove abs() from the string pseudo-object, so you are essentially just taking all the functions in the global namespace and attaching them as a method to every pseudo-object. Is that clean? I think there is something we can do around this, but an argument of "it is sexy and clean" needs to be backed up with some actual implementation details that make sense. -Rasmus