Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92698 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35635 invoked from network); 24 Apr 2016 16:58:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2016 16:58:04 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.66 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.220.66 mail-pa0-f66.google.com Received: from [209.85.220.66] ([209.85.220.66:36355] helo=mail-pa0-f66.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/93-13951-91BFC175 for ; Sun, 24 Apr 2016 12:58:02 -0400 Received: by mail-pa0-f66.google.com with SMTP id i5so13264814pag.3 for ; Sun, 24 Apr 2016 09:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=ec5O6Ttn3F6dfdOHk67G11BBksR8UF/bFyHCocCr2c0=; b=QuM92cFkcCa1sEEg1fGcSrSLehMMNSgRO8Ajd0TFbxKH/oAo9YtXb+qhFlkQ8zT15W Ab4I2nIc+p5oygweciaLiptpY2OhtNZ/r7UyUse7UJCmxbVwYzgUT71KeIMR0Gnz7++C bdcIXAS4OmMBqqEMsn+LMqsJA10rrlh1b3+97QFMEfMXPp/lI4aLLWwhtJ7ijzpv/m9p 73cYZoX3rP0wPIvpifxKPs+vys6vzVR2z/vDfkJUevDvj7u9xOlHTS3bDPGJD5uJsj5S IEJjmU6SeCTMzg9WlbYfhwhBnFx4wc4k/eO9pwrllnmYEQqCY4fyW43seUC2Y8nmr/Up TZ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=ec5O6Ttn3F6dfdOHk67G11BBksR8UF/bFyHCocCr2c0=; b=C/3wikfMSdZ5sxZz+7wJ4KhjITzKw47kGhQ6WUhQKW45IPkueV93rqnY5rSBr0nu0a ZvRV2pg0zf66U4wXAHgHt+yip3SzB8ZJ/H1TcrDwjUXlZuXvou3abC764fgEuF1s/9JO ONXACSPSkj71AJUm2NfbyaYpVC/6/N+ARNTv9SsGBUDFKiL41tvJg/a9omXLeEwdcqbf 5gGbs7DhEG2bmGn4QfQCwULZv6nMln3onXI6LFtthGhl4l5DhcBY8RVEcuGg/xSdf6YN 1FqgzC2OEywztozg5+oe+d0cJc1C/27THz4Ir35mdv2LvDnUkq7t0HuFTimAzzqHBPS7 /lcg== X-Gm-Message-State: AOPr4FXXued/ncN/NpWY3Fp+r3xLGC67Dyr2TXL9fkXg28PnK7YP/sXpcgec4zExnPMchkLoVyqzgrPvSYnWHg== MIME-Version: 1.0 X-Received: by 10.66.40.236 with SMTP id a12mr43341731pal.58.1461517079204; Sun, 24 Apr 2016 09:57:59 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.66.132.79 with HTTP; Sun, 24 Apr 2016 09:57:58 -0700 (PDT) In-Reply-To: References: Date: Sun, 24 Apr 2016 10:57:58 -0600 X-Google-Sender-Auth: WiJbyVKQfp29hLu3v6In_fctTuI Message-ID: To: Dan Ackroyd Cc: Dmitry Stogov , internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: levim@php.net (Levi Morrison) On Sun, Apr 24, 2016 at 10:03 AM, Dan Ackroyd wrote: > On 21 April 2016 at 22:13, Dmitry Stogov wrote: >> Hi, >> >> >> I would like to present an RFC proposing support for native annotation. >> > > Hi Dmitry, > > Although everyone will have an opinion about the syntax, I think there > is one criticism that should be thought about; the chosen syntax isn't > future expandable to other concerns. > > People have talked about "design by contract" RFCs where annotation > like data is readable by the engine. The current proposed syntax > _could_ be used to store DBC data, but it would not be clear what > would be annotation data to read by the application, and what was DBC > data to be read by the engine. > > Changing the proposed syntax to be something like @attr(...) would > allow it to be expanded in the future by adding a @contract(...) > construct: > > @attr(test($a + $b > 0)) // This is attribute data read by userland code > @contract(require($a + $b > 0, 'InvalidFooArgsException')) // This is > DBC data read by the engine. > function foo($a, $b) { > ... > } > > Making features be compatible with future features would avoid a lot > of potential pain down the road. Genuine question[1]: how is @attr() different than `<>`? Also, isn't `@attr()` 100% valid user-land code today that can precede function or constant declarations? [1] I don't like that I have to make that explicit but it is what it is.