Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92701 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53120 invoked from network); 24 Apr 2016 20:45:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2016 20:45:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=danack@basereality.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=danack@basereality.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basereality.com from 209.85.161.171 cause and error) X-PHP-List-Original-Sender: danack@basereality.com X-Host-Fingerprint: 209.85.161.171 mail-yw0-f171.google.com Received: from [209.85.161.171] ([209.85.161.171:33911] helo=mail-yw0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B8/66-13951-3503D175 for ; Sun, 24 Apr 2016 16:45:08 -0400 Received: by mail-yw0-f171.google.com with SMTP id j74so152364656ywg.1 for ; Sun, 24 Apr 2016 13:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=vunQuSZEKiA0fSXx3d0L9AAZI9TktxqWP3XYoEEoWWQ=; b=I3aDNHLe+YAxjV9T5Jegg1myxi9mtUwyktW/yRAeVqw9lytC4nf8XqzQY2Qol5/5pQ nOGiDhvlA/p388evDAMHqpV3qDoXpFcutpm9F1WXvfwsqM47CjHG+jmMYy3gySS3MvF3 q7fswrQrsm6xkkECmGBa6p/6+R9eihlLKkPla9/ddUCTTI9LGya0oBGP1XmknDawe4Wx tpbYeCyXNaus1KRLaOiGsKYp4Y6Wk9I2eNVaIT9wKSO6QRot3WMTPV1eAhrOnAGOGFr7 RZVddMBgrtF/37bt05io2Pl8wRDKqFPyG5bIZyqassS6glpRYARs4OHtYO5oGWNVOFek GAUw== 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; bh=vunQuSZEKiA0fSXx3d0L9AAZI9TktxqWP3XYoEEoWWQ=; b=fHN98rc3uJ+8/pyVMwaho+RyM6REccGgz/mgLHsATefNru3K/BULPkTOy3pGKvq4mQ 0JSyQjU/sGYRwUHEQgw2Uvtaonx7V2qmFFaZQNKmDiBAbj0Ye3GrHS2yHjE7QXr7SIop IJc9gSt9jJztV+mqIYxc+sca6C7tPKQ8FYqesdPHIMkfGIiaHw+vBPoWnKbXsrS0+ZfG WQCD55KB9Qqe0l7gqgbwKBww3J5TjIaeJJTOBTOxJ4a9rBCxIV7K4xgyW0mm7BMerbLe 4Mnnj+6c1HGXnOVcD0gNKs18laz0t6x6g9xsiwsCHo4b24hPfBF74/lUVFIDf1ic+i0m cJpQ== X-Gm-Message-State: AOPr4FUm6BfhUrrtyYB7mGuUclfha6V9kkeKM8iZc1op5WrZWFSZj2oqQ8XL4PwlghrmbCR5rv12HTvrm/NUDQ== MIME-Version: 1.0 X-Received: by 10.37.28.9 with SMTP id c9mr19098659ybc.174.1461530704896; Sun, 24 Apr 2016 13:45:04 -0700 (PDT) Received: by 10.37.89.6 with HTTP; Sun, 24 Apr 2016 13:45:04 -0700 (PDT) X-Originating-IP: [2.99.227.0] In-Reply-To: References: Date: Sun, 24 Apr 2016 21:45:04 +0100 Message-ID: To: Levi Morrison Cc: Dmitry Stogov , internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: danack@basereality.com (Dan Ackroyd) Hey Levi, TL:DR, if we can reserve some syntax for annotations that will be used by the PHP Engine, that would cover my concern. On 24 April 2016 at 17:57, Levi Morrison wrote: > isn't `@attr()` 100% valid user-land code today that can precede Er, yes it is! I didn't put too much thought the suggestion. The point I was trying to make is that it explicitly says that "this is a userland attribute", rather than using the generic <<...>> syntax, which we might want to use for non-userland attributes at some point. > how is @attr() different than `<>`? If this RFC passes, someone could implement their own DBC feature using an annotation similar to: < 0, 'InvalidFooArgsException')>> Which under the current RFC proposal, would just be a standard annotation as far the PHP Engine is concerned. The framework/application the person is using would do the work to implement the DBC feature in userland code. In two years time when we want to implement dbc in the Engine, we would need to choose between either: * using <> as the syntax for the PHP internal feature, which would break userland code where they had chosen the same name we had. * using a different syntax to the <<...>> one to implement a DBC feature. * think up a cunning way of adding to the <<...>> syntax that doesn't break existing code that uses anotations. Choosing a syntax now that can be expanded for other uses in the future, is easier to do now, rather than in two years time, when it would be a BC break. Hack has implemented some 'special' attributes[1], that are interpreted by the HHVM Engine. All of those special attributes start with double underscores. If we did the same, and reserved (through documentation), that annotations starting with leading double underscores are reserved for future expansion, that would allow us to implement them (if we wanted to) without too many complaints of BC breakage. i.e. <> // this is a userland implementation <<__dbc(...)>> // Reserved for PHP internal implementation. cheers Dan [1] https://docs.hhvm.com/hack/attributes/special