Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61371 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80869 invoked from network); 17 Jul 2012 17:46:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2012 17:46:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:60124] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0C/25-54353-705A5005 for ; Tue, 17 Jul 2012 13:46:48 -0400 Received: by lbgc1 with SMTP id c1so1043155lbg.29 for ; Tue, 17 Jul 2012 10:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer; bh=AdmPgSCAToHxw7eAJ22JUo0TSNR4MmG2/8sQQEF96s8=; b=b+dhIk5RCtgw5K7V+RCIKX6ujGOJIXSf/7gSbAnzDeI/AcX0gN14PvMsMb/c9FHoY5 YgTZC5MWhoeIcFWTlC5qYeLY4Oh+Eszt3Jl5hY2gOCJ+mWtZZweOfYkN3tSyMM5248h7 Uz99gDF6wMFm3VjEPyJvEvZoJsML6clA0fiRXV1xbSLzXlgisvkDB5r1vaAMmDR6A83/ i5giK4Kl26k/mIQLXZcKA5Qv5KT3FwFeCI1enpYMqnPQmGBZn7UFD3G0DByqmSNo1Gsj Abmhk/vi6Is1fMJoBFEUpqSaobf46ddJ1KZmtW2gfrZc10t5O1NelA4txFuN0zOOxJ4g +Dxg== Received: by 10.112.23.200 with SMTP id o8mr200805lbf.9.1342547205105; Tue, 17 Jul 2012 10:46:45 -0700 (PDT) Received: from [10.0.1.7] ([93.185.190.227]) by mx.google.com with ESMTPS id b3sm4256485lbh.6.2012.07.17.10.46.41 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 10:46:43 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/signed; boundary="Apple-Mail=_EB010E77-4B4D-4806-868D-539B57A65429"; protocol="application/pgp-signature"; micalg=pgp-sha1 In-Reply-To: <50059AF8.5050805@sugarcrm.com> Date: Tue, 17 Jul 2012 21:46:38 +0400 Cc: Pierre Joye , Gustavo Lopes , internals , Andrew Faulds Message-ID: <9430CE0C-7DA4-4655-92D5-056E12A7BC74@gmail.com> References: <50059AF8.5050805@sugarcrm.com> To: Stas Malyshev X-Mailer: Apple Mail (2.1278) Subject: Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.) From: indeyets@gmail.com (Alexey Zakhlestin) --Apple-Mail=_EB010E77-4B4D-4806-868D-539B57A65429 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On 17.07.2012, at 21:03, Stas Malyshev wrote: > Hi! >=20 >> This idea has been proposed many times in the past and it is actually >> a very good proposal, for array, string or other types. >=20 > If we have "$array->foo()", we should also have "class foo extends > array" which allows to override foo() in array. This will require some > serious changes, which need to be RFCed and reviewed and seen if they > can really fit the language properly. Just saying "let's bolt on = method > calls on top of arrays" is definitely not very good. Having OO Array > type may be good, if we will be able to figure out suitable design = that > will allow the same flexibility and power as regular arrays - though = I'm > not sure how to do it now. >=20 >> 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. >=20 > I disagree - I do not think we need pseudo-objects. If the only point = of > the exercise is to convert a call of array_pop to $array->pop, it's = not > worth it. It'd just make the language more messy - you wouldn't know > what -> means anymore. +1 I am for making array a proper class with methods. "Legacy" functions can be implemented as wrappers around it: function array_push(&$array, $value) { $array->push($value); } There is absolutely no sense in creating new "pseudo object" entity. It = would just add tons of confusion. p.s. in case of array, we already have http://docs.php.net/ArrayObject = which is a good starting point= --Apple-Mail=_EB010E77-4B4D-4806-868D-539B57A65429 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) iQEcBAEBAgAGBQJQBaT/AAoJEM8kLGy4PJ4J+QoIAMcKDCyqzDTwnDQh/j7AI27L 30rQOjQkRketnK/XCA7l/l0SFzqUYQ2efm7CvjtJJX2pF1RO4h79/Q4pVbZRSaOc SCUYe6gMIMH7hWtbxxBKf62jlFnL2OsHHytpKSkS/T0LCeDYhIaO3IzJMTZG27Tj rpLZYhuY02/0lvPzN7wixv++A6NahrORLLRspCC2IGMUyr3vPR/rhpaGxd8kTyh4 DGxYeulUEIZv1wZBGVlW4GuhxpnWyNHMWETSHr2XXwXzuHduJo7OWw99xJ15siNm iYpiZSy7PEq9F+yvZnRLqq/B+hc9jUgH6x3tipIINo1yIU7se3V6oSkrXj5vC3E= =K83K -----END PGP SIGNATURE----- --Apple-Mail=_EB010E77-4B4D-4806-868D-539B57A65429--