Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61377 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93940 invoked from network); 17 Jul 2012 19:53:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2012 19:53:09 -0000 Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; 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:63176] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/97-54353-4A2C5005 for ; Tue, 17 Jul 2012 15:53:08 -0400 Received: by lbgc1 with SMTP id c1so1213178lbg.29 for ; Tue, 17 Jul 2012 12:53:05 -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=3NynKUR5D8r0CDpIcL4qGBQfLs+3Mx0TjjddxNvOfCk=; b=ThMzlaLErN25dnnJXuEiHQa4eqSPbM6oecIBR7idUC6lmRCBJckhnwTwx8qqTjKibA JZKvYCTFdTrKXSsoPM8XhMNQzd51zaiUVnEdNBfr0/thDP6viuxRwjOPlIeNATrkB7EE Sg6JvA+DVzdmVL7TMe/nYiHR8tQa9NxYhFiY6vaQVM8Qs9xCrPoP5ZGxlMN0K7ar+yUx PLrjbj09CwROcfmO4au3ICCVgPfXd4YMc/VdkeJ3YZL39YDN4OtGw+fTqPpAPjayHNZi yOXqz+6ZqcmNQrHOw18CpwwDKRCfk/pw7ZdnPWNXtyRIK67UuTb26P5f4Yq4tnbmwgm0 HZ+A== Received: by 10.152.135.200 with SMTP id pu8mr304317lab.8.1342554785456; Tue, 17 Jul 2012 12:53:05 -0700 (PDT) Received: from [10.0.1.7] ([93.185.190.227]) by mx.google.com with ESMTPS id gi19sm19734089lab.16.2012.07.17.12.53.03 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 12:53:04 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/signed; boundary="Apple-Mail=_FE58CE0F-B640-43FE-8319-D6BB1ACCCB42"; protocol="application/pgp-signature"; micalg=pgp-sha1 In-Reply-To: <5005BB06.6020909@sugarcrm.com> Date: Tue, 17 Jul 2012 23:53:03 +0400 Cc: Pierre Joye , Gustavo Lopes , internals , Andrew Faulds Message-ID: References: <50059AF8.5050805@sugarcrm.com> <9430CE0C-7DA4-4655-92D5-056E12A7BC74@gmail.com> <5005A5E4.2030004@sugarcrm.com> <5005B68E.8080805@sugarcrm.com> <5005BB06.6020909@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=_FE58CE0F-B640-43FE-8319-D6BB1ACCCB42 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On 17.07.2012, at 23:20, Stas Malyshev wrote: > Hi! >=20 >> That would be: tokenizer + static analysis (with type inference) + = replacing some of the tokens. >> Not a trivial task, but definitely doable. >=20 > So what would this tool do with this code? >=20 > $a =3D getFirstArrayName(); > $b =3D getSecondArrayName(); > $$a =3D $$b; > $b[1] =3D 0; Something like this: $a =3D getFirstArrayName(); $b =3D getSecondArrayName(); if ($$b instanceof ArrayObject) { $$a =3D clone $$b; } else { $$a =3D $$b; } $b[1] =3D 0; > Or this: >=20 > include 'a.inc'; > $a =3D $b; > include 'b.inc'; >=20 > where a.inc has array $a and b.inc has something like $b[1] =3D 0; but = you > have no way of knowing it since by the time you run the tool a.inc and > b.inc are not available to it (think config files). well, the same as above. not pretty, but that's a safe fallback when = type inference is not available. --Apple-Mail=_FE58CE0F-B640-43FE-8319-D6BB1ACCCB42 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) iQEcBAEBAgAGBQJQBcKfAAoJEM8kLGy4PJ4JrRgIANLUkw4yy0iXs1AhJHByS4Ao j8ggSMATQM2bEChr/7gQc/T4eV2/wlmHagEgK8af8Wn0Iuk8P6gHM6ssFOiTQXp+ Fq44P0Grj4sfi/pP7IQOpjl0KFCUcKGlUDtBNT5YOlYTK0k7tFFyEsDpCvLr2i7s wyHoUb8qhiF7zEfkQiPmTH9sBUhXIjUG4ltfhlHWWgJsL0w7kqi2Y3CEnsG884uS sEWovpuvlqXXaKGSja0ZNxOBJIixzfWuVE7Yl69sLGp5bVMR/oxcFwvDq/4S8UB+ HoyRE4uelPEwNRgivEv7P9IXRevrTcfkkbVutujMN5LVC6D2cGtQPs42SfAcCJU= =D2Mw -----END PGP SIGNATURE----- --Apple-Mail=_FE58CE0F-B640-43FE-8319-D6BB1ACCCB42--