Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82058 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8091 invoked from network); 6 Feb 2015 18:22:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2015 18:22:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.177 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.213.177 mail-ig0-f177.google.com Received: from [209.85.213.177] ([209.85.213.177:64729] helo=mail-ig0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/BE-45146-25605D45 for ; Fri, 06 Feb 2015 13:22:10 -0500 Received: by mail-ig0-f177.google.com with SMTP id z20so4548762igj.4 for ; Fri, 06 Feb 2015 10:22:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=hmXMfWm9jBXSjr8NvQHBEFaJgY5FfV6wYKTztwCo5qc=; b=uVieEd+vPhcfdaVyVKW0rRtgMfiYTSb+oJwQzUmuS1pda6FAK1EM/mgBqraSbN9lw6 fEtce9Ej87RO7HPfP12waItVPs1sThZWYWtI3LoxjQWpa57hnfvaL3NjVcrOw6HFEtur l6QzRf8VRWLoqij4kxNcM6C/7o7f7XvdMIuaC7HX+5VmxrfEy3sP/zGDRns+OHdzhBOg fwFIUxe7bT5I5y9h1wid61gxUFzteMv9uq96Uj9moG0rU+osMad8n+kJ807oyfTmLupx 8lrGAyttAwsgWWbKTCQ+CzKFYXiilvZbWg3Y+4uAgudw0keawZGmmXxhV5ZfOHPE2FHo sIVQ== X-Received: by 10.42.13.77 with SMTP id c13mr4940611ica.75.1423246927585; Fri, 06 Feb 2015 10:22:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.238.75 with HTTP; Fri, 6 Feb 2015 10:21:47 -0800 (PST) In-Reply-To: <54D4FFA4.3010703@birkholz.biz> References: <54D37D41.2030706@hoa-project.net> <54D470FA.6000303@hoa-project.net> <02d301d041f3$0c5f3990$251dacb0$@tekwire.net> <031501d04217$b393bff0$1abb3fd0$@tekwire.net> <54D4FFA4.3010703@birkholz.biz> Date: Fri, 6 Feb 2015 13:21:47 -0500 Message-ID: To: Dennis Birkholz Cc: PHP internals Content-Type: multipart/alternative; boundary=20cf3043530a8be842050e6f7fc2 Subject: Re: [PHP-DEV] Design by Contract From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") --20cf3043530a8be842050e6f7fc2 Content-Type: text/plain; charset=UTF-8 Hi Dmitry, So, can we start drafting out some things? Simple questions would help everybody to get this moving forward. I'll compile a simple list of questions to answer that would drive the direction on how it would be implemented. Please ignore the formatting on HOW they are defined. Tokens can change. Here it is: 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? I think we have a good start now... =) []s, On Fri, Feb 6, 2015 at 12:53 PM, Dennis Birkholz wrote: > > On the other hand you have a working solution. > > You won't be able to use annotations for PHP5 projects anyway. > > Except, if we put them into comments or doc-comments. > > > > /**[Attribute(Value)]*/ > > Why not /**@ Attribute Value */ or /**@ Attribute(Value) */? No [] > required and @ looks more familiar with docblock annotations in use. > > -- > 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 --20cf3043530a8be842050e6f7fc2--