Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82047 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61755 invoked from network); 6 Feb 2015 14:58:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2015 14:58:26 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.177 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.177 mail-vc0-f177.google.com Received: from [209.85.220.177] ([209.85.220.177:54683] helo=mail-vc0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/65-45146-196D4D45 for ; Fri, 06 Feb 2015 09:58:26 -0500 Received: by mail-vc0-f177.google.com with SMTP id hy10so2889025vcb.8 for ; Fri, 06 Feb 2015 06:58:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=NKCE6Uk15ZClCpN/mMZivUMyjYQuCLo5wdXjSN8M+uY=; b=d/1H6mVs3X9oUfNkwtcU6LtqTC22AQ3Se075vbva2hCG8Fmg4xd5JUoNHZjvkF4p+P +i6eoV7KrAHoitL30Ug11w2RKi41fNIoqOe3hwwrChNvpek3/+7LGgpaXneXcktMd+5I tF7K4FLTUz0AJAdo2T4i8ttQ5K0KY5ZTzPRxxz8qpNdYHFIvuehxjq2O/oolbzRDZjOw qZGgh3VW3NarLY8W7uXE1rBS7VruuWrWNcEmFJ1+Hky97ZQ4u7bJE8WrGd28U0uJTnGT Ttz4bPcgeq5Ye+SITWRlirauYXLGzyRJkeH9fhz9VWAog3Rj41iFigG1vHrgb9ZDaKFX iAcQ== X-Gm-Message-State: ALoCoQlrUmYBF8kx5Bao2hyC1Y0EJa7NE/1lupFdbglCMvGexmuQfRZYH8gyUTD9wri0pmSkXONEIzBDAK95bQv/z4YKebsK/+xPYTwCH3bZNiMpkNjfUqDn7zUigDh7Qvm9dN2hMn7ThZyZAY1SyryxWI5rV7laMw== MIME-Version: 1.0 X-Received: by 10.221.44.65 with SMTP id uf1mr2322286vcb.46.1423234702787; Fri, 06 Feb 2015 06:58:22 -0800 (PST) Received: by 10.52.74.73 with HTTP; Fri, 6 Feb 2015 06:58:22 -0800 (PST) In-Reply-To: References: <54D37D41.2030706@hoa-project.net> <54D470FA.6000303@hoa-project.net> <02d301d041f3$0c5f3990$251dacb0$@tekwire.net> <031501d04217$b393bff0$1abb3fd0$@tekwire.net> Date: Fri, 6 Feb 2015 18:58:22 +0400 Message-ID: To: "guilhermeblanco@gmail.com" Cc: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= , Yasuo Ohgaki , Pierre Joye , "Ivan Enderlin @ Hoa" , PHP internals Content-Type: multipart/alternative; boundary=001a11c3ea3ce46085050e6ca60c Subject: Re: [PHP-DEV] Design by Contract From: dmitry@zend.com (Dmitry Stogov) --001a11c3ea3ce46085050e6ca60c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable in my opinion, RFC looks reasonable. can you remember main arguments against it. why it was declined? For PHP7, it may be possible to change RFC to accept any PHP expression as annotation value. Then this expression may be captured as AST or evaluated to constant. Thanks. Dmitry. On Fri, Feb 6, 2015 at 5:35 PM, guilhermeblanco@gmail.com < guilhermeblanco@gmail.com> wrote: > Hi Dmitry, > > Last time we discussed was this one: https://wiki.php.net/rfc/annotations > The ideal one was the version before: > https://wiki.php.net/rfc/annotations?rev=3D1300089833 > > To have this in core, we need to step back and re-evaluate how we could > achieve 80% minimum. My original proposal was trying 95%, too much. > We could get 80% by having a simpler implementation, something like this: > > <[ new Foo() ]> > class Bar > { > } > > And all it would be required is 2 new methods as part of Reflection > classes. > The example could be translated into this: > > $bar =3D new \ReflectionClass('Bar'); > $bar->setMetadata([ new Foo() ]); > > var_dump($bar->getMetadata()); > > array(1) { > [0] =3D> object(Foo) > } > > Does that sound reasonable? It would allow us to achieve "nested > annotations". > However, it would not achieve a bunch of other things, like named > parameters (you couldn't only do one or two as a constructor params... > Foo(null, null, 'value') would be seen everywhere). > We forget about inheritance, so metadata wouldn't be propagated to > inherited classes, methods or properties. > Also, if we implement in important Reflection structures, that would > incredibly improve its power, such as: ReflectionClass, ReflectionPropert= y, > ReflectionMethod, ReflectionParameter and ReflectionFunction. > > I think this is more reasonable than my original proposal, addresses 80% > of use cases and still help all projects around. > Named parameters would be my next battle then... =3DD > > > []s, > > On Fri, Feb 6, 2015 at 9:17 AM, Fran=C3=A7ois Laupretre > wrote: > >> > De : yohgaki@gmail.com [mailto:yohgaki@gmail.com] De la part de Yasuo >> Ohgaki >> >> > Personally, backward compatibility is not too important. >> > PHP5 is dead by PHP 7.2 release... This is the reason why. >> > It's only 3 years later, only 2 years later after PHP 7.0 release. >> >> That's where we disagree, as I think it's most important. >> >> Thinking that PHP 5 is dead in 3 years is extremely na=C3=AFve IMO. You >> probably didn't live the PHP 4/5 migration but I guess we won't have mor= e >> than 30 % of production servers under PHP 7 in 2018, just due to the del= ays >> of distros, hosting companies, and others. >> >> Now, suppose you're distributing a library or a framework, like Symfony, >> Doctrine, etc. Someone tells you : "Here's the new DbC feature. You can = use >> it but this implies splitting your code to two independent branches and >> maintain them in parallel until you have no PHP 5 customer anymore.". Wh= at >> do you think you'll do (or won't do) ? >> >> @Pierre,@Dmitry : you have a better vision than mine on the migration >> process. What's your opinion on forcing software developers to maintain = two >> separate branches ? >> >> Once again, the conditions in @assert lines ARE PHP code. There's no new >> syntax. There is no real difference between writing 'assert()= ' >> and '@assert ', especially if the require/ensure blocks shoul= d >> contain 'assert' statements only. >> >> > What I believe is not important to you. I could be wrong. >> >> It is important. As I may be wrong too. >> >> Cheers >> >> Fran=C3=A7ois >> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > -- > Guilherme Blanco > MSN: guilhermeblanco@hotmail.com > GTalk: guilhermeblanco > Toronto - ON/Canada > --001a11c3ea3ce46085050e6ca60c--