Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82126 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34881 invoked from network); 8 Feb 2015 08:24:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2015 08:24:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.41 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.216.41 mail-qa0-f41.google.com Received: from [209.85.216.41] ([209.85.216.41:37884] helo=mail-qa0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/81-24707-85D17D45 for ; Sun, 08 Feb 2015 03:24:56 -0500 Received: by mail-qa0-f41.google.com with SMTP id i13so4157477qae.0 for ; Sun, 08 Feb 2015 00:24:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=O9NKAlhZUojzAjHKtK/f9c8QsdcDm7sc4CIBhtcsflk=; b=gHFOc89kv/wXTBMibFGpXmZILmeMoGK+fYvOLEfznCRTEEBzPA6Prblwtco8z0zXx/ fBVMRfVHmHEIB13+txHdVqe+hGonhUJSm/a0MsJLuDvy+XjdVx0NX/d6Kvo9cdWZPAiY NuxxNPs5WHnIswFl813DaVWEtDbxJGsVDRgFzyYXDRvbQ987yJMtmYmoMv3/X1j6sO+k Jmswz8iObAPXL4FBhMpHsADYd/i8aMOidl2sK2NJzo3tiSQmAPNOTjiTQRgTu/YYJRVp a+C9OntoabQBcZ9HVKL1r06sdX9offukIjeFve7tYpDEBfR/S/9Rq4qjSQdsY4CXBw7F rrkQ== X-Received: by 10.140.97.203 with SMTP id m69mr26834666qge.39.1423383893331; Sun, 08 Feb 2015 00:24:53 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.28.72 with HTTP; Sun, 8 Feb 2015 00:24:13 -0800 (PST) In-Reply-To: References: Date: Sun, 8 Feb 2015 17:24:13 +0900 X-Google-Sender-Auth: pK1Zp-q4FKVJYYhZji8wb635f4E Message-ID: To: guilhermeblanco , =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a113a2aa2575538050e8f63c1 Subject: Re: Design by Contract From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a113a2aa2575538050e8f63c1 Content-Type: text/plain; charset=UTF-8 Hi Guilherme and Francois, Could you give your ideas for these? Thank you. -- Yasuo Ohgaki yohgaki@ohgaki.net On Sun, Feb 8, 2015 at 5:16 PM, Yasuo Ohgaki wrote: > Hi Dimitry, Francois and Guilherme, > > On Thu, Feb 5, 2015 at 8:14 PM, Dmitry Stogov wrote: > >> Hi Yasuo, >> >> Following our conversation, I tried to imagine how DbC should look like >> in PHP from user perspective. Finally, I was influenced by the semantic >> proposed in D, and syntax proposed for Java. So, these are my initial >> thoughts: >> >> For php it may look like the following: >> >> function foo() >> requre() >> ensure() >> { >> ... >> } >> >> It would require only one new reserved word "ensure". >> > > Should I add D like version to the RFC? I don't care much about syntax as > long as > we have DbC. > > https://wiki.php.net/rfc/dbc > > Like Guilherme suggested, make some decisions first? > > > 1- Doc comments vs. outside? > > 2- Keep object instance creation the same? IE: @Foo vs new Foo() > > 3- Is constructor the only way to inject parameters? > > 4- What if we have optional arguments, like: @Foo("bar", null, null, > "woo")? > Suppose that you wanna fix the optional arguments by declaring names (like > this: @Foo("bar", test="woo")), doesn't it collide with PHP interests of > not supporting parametrized arguments? How would parameter skipping > proposal address this in a nicer way? > > 5- How would you deal with inheritance? Should a method inherit the same > annotations from parent or not? > Should we add ability to flag to inherit or not? What about overrides? > Would they be allowed? Is there a vague idea on how this concept could be > achieved? > > 6- Would you be possible to change annotations value at runtime? > > 7- Would we validate annotation arguments at all? Consider as array? > Properties of objects? > > 8- In case we take the approach of properties of objects... how would we > flag that a given class can/cannot be used as annotation: another > annotation, interface, any other idea? > > 9- Would we and/or wow would we flag that a given class could be used only > in a class and not in a method? > > 10- How would it be the syntax to declare a new annotation? > > > Since people's preferences are diverse. It might be a good idea having > pre-vote > for designs, then we may have final vote with single design. > > We need some consensuses even for pre-vote. > > What do you think? > > > Guilherme, is this the RFC you've mentioned? > >Whenever you feel ready to get true, complete Annotations into core > > https://wiki.php.net/rfc/annotations > > Just making sure. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > --001a113a2aa2575538050e8f63c1--