Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60385 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62370 invoked from network); 1 May 2012 12:02:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 May 2012 12:02:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=reeze.xia@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=reeze.xia@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: reeze.xia@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:43199] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/43-38165-DC0DF9F4 for ; Tue, 01 May 2012 08:02:21 -0400 Received: by pbbrp12 with SMTP id rp12so3126705pbb.29 for ; Tue, 01 May 2012 05:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:subject:x-mailer:mime-version :content-type; bh=Z4y4J1M2X2M2YoR+n1HA8d6oOTXbl050BqQ27pxyx9w=; b=IYNtlhylZBGOhgrURj+Uwo8jJNqiI8BnI2w4mWD7K11MpEllgwIiofIQt5R9YcX35t 3bAqpw9aFY/N7Ba7p0KLbSgeMbfJO32mEABnjwgpdCkMCleiEnIFdoqsI4XwH3dqWcSI PizdI8yE921zxtz9oUb7fyEX+TeU+TCjpphBuct84PYYP0L50RjMCHuq45QLEiaLps+t JfQzHXfWgdQ9Us6ukscyP05M23z0vqmO4y0k1zZ6xhDRkIrQ3rOCzYwiUGluOy2YN7Pi gpKg6MAhuCArWp/80CpQEF2sJlgCJdJvlQoaVb5TkZddRGsddvvp6zAXctd8DLDow9gK Vo2w== Received: by 10.68.218.228 with SMTP id pj4mr17882819pbc.167.1335873738751; Tue, 01 May 2012 05:02:18 -0700 (PDT) Received: from MacBookPro.local ([117.79.232.131]) by mx.google.com with ESMTPS id l1sm19108519pbe.54.2012.05.01.05.02.08 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 May 2012 05:02:16 -0700 (PDT) Date: Tue, 1 May 2012 20:03:41 +0800 To: "=?utf-8?Q?internals=40lists.php.net?=" Cc: tony2001@php.net, danko@very.lv, stas@php.net, dmitry@php.net, laruence@php.net, nikic@php.net, felipe@php.net Message-ID: <3B7600EC10A34F89AA8195C7A83089C0@gmail.com> X-Mailer: sparrow 1.3.2 (build 814.60) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4f9fd11d_4c187c90_1842" Subject: Bug/Req:#61422顛 enble Type Hint autoloading From: reeze.xia@gmail.com (reeze) --4f9fd11d_4c187c90_1842 Content-Type: multipart/alternative; boundary="4f9fd11d_6835b2ae_1842" --4f9fd11d_6835b2ae_1842 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi internals: =20 danko reported this bug=2361422: Lack of autoload on type hinting breaks= class=5Falias=E3=80=82 now parmeter type hint DID NOT trying to autoload. I think allow it autol= oading could be helpful. =20 BUGS&Commit for quick refer: - https://bugs.php.net/bug.php=3Fid=3D61422 - https://bugs.php.net/bug.php=3Fid=3D39003 - http://svn.php.net/viewvc=3Fview=3Drevision&revision=3D220906 PROPOSAL(=46R)=EF=BC=9A **I'm asking if we can enable type hint autoloading=3F** I did some homework: - Before =46IX for =2339003, parameter type hint will try to autoload the= hint class if not found. after this fix it will not. in bug=2339003: the final result was DOC Pro= blem, seems we all agreed that it SHOULD autoloading. - But in revision: http://svn.php.net/viewvc=3Fview=3Drevision&revision=3D= 220906 It was **=46IXED** I try to search R=46C about typehint, I didn't find anything about it. I= t was commited really long time ago almost 6 years ago, it would be very nice if Antony Dovgal still remembe= r it;) REASON=EF=BC=9A Here is my reason to ask whether we can enable it: 1. Autoload will only happened when function/method calling. so does any = other autoloading, I mean it wouldn't hurt performance. 2. Class will be used for sure, so trying to autoload it is reasonable: - If we need check certain Class, then we have to use the class in functi= on/method. - most of time it already loaded*, so autoloading happened rarely. 3. If pass the wrong type and the hinted class not found this gives auto= loader a change to handle it =20 like the =2361422' (https://bugs.php.net/bug.php=3Fid=3D61422)s test scr= ipt did. we can do something if not found. since we use the class in =20 function/method, autoload the class is reasonable. most of the time we w= ould not use the *=46EATURE*, but it could make it more flexible. PATCH: 1. change zend=5Fverify=5Farg=5Fclass=5Fkind to autoload class 2. if class can't load, zend=5Ffetch=5Fclass silently return (No fatal he= re) to give zend=5Fverify=5Farg=5Fclass=5Fkind a chance to report previous catchable=5Ffatal=5Ferror eg=EF=BC=9A Catchable fatal error: Argument 1 passed to func() must be an instance o= f AX, integer given=E3=80=82 a simple patch attached request for comment. =46inally, What do you guys think about it=3F Thanks. Best, -- =20 reeze =7C simpie.com --4f9fd11d_6835b2ae_1842 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi internals:
danko reported this bug=2361422: Lac= k of autoload on type hinting breaks class=5Falias=E3=80=82
now= parmeter type hint DID NOT trying to autoload.  I think allow = it autoloading could be helpful. 

BUGS&a= mp;Commit for quick refer:
https://bugs.php.net/bug.php=3Fid=3D6142= 2
https://bugs.php.net/bug.php=3Fid=3D39003
http://svn.php.net/viewvc=3Fview=3Drevision&revision=3D220906<= /a>

PROPOSAL(=46R)=EF=BC=9A
**<= u>I'm asking if we can enable type hint autoloading=3F**
I did some homework:
- Before =46IX for =2339= 003, parameter type hint will try to autoload the hint class if not found= .
          after this fix it will not= . in bug=2339003: the final result was DOC Problem, seems we all agreed
          that it SHOULD autoloading.
&= nbsp;         I try to search R=46C about typehint, I= didn't find anything about it. It was commited really long time ago
          almost 6 years ago, it would be = very nice if Antony Dovgal still remember it;)

REASON=EF=BC=9A
&nbs= p;   Here is my reason to ask whether we can enable it:
1. Autoload will only happened when function/method calling.= so does any other autoloading,
    I mean it wouldn'= t hurt performance.
2. Class will be used for sure, so trying t= o autoload it is reasonable:
       - If we= need check certain Class, then we have to use the class in function/meth= od.
       - most of time it already loaded= *, so autoloading happened rarely.
3. If pass the wrong type an= d the hinted class not found  this gives autoloader a change to h= andle it 
    like the =2361422's test script did. = ;we can do something if not found. since we use the class in 
<= div>    function/method, autoload the class is reasonable.= most of the time we would not use the *=46EATURE*,
  &nbs= p; but it could make it more flexible.

PATCH<= /b>:

1. change zend=5Fverify=5Farg=5Fclass=5F= kind to autoload class
2. if class can't load, zend=5Ffetch=5Fc= lass silently return (No fatal here) to give zend= =5Fverify=5Farg=5Fclass=5Fkind a chance
    to report= previous catchable=5Ffatal=5Ferror eg=EF=BC=9A
Catchable fatal error: A= rgument 1 passed to func() must be an instance of AX, integer given=E3=80=82

a simple patch attached request for c= omment.

=46inally, What do you guys think about = it=3F

Thanks.
Best,
-- 
ree= ze =7C simpie.com
--4f9fd11d_6835b2ae_1842-- --4f9fd11d_4c187c90_1842--