Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105664 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16148 invoked from network); 10 May 2019 17:08:18 -0000 Received: from unknown (HELO mail-it1-f193.google.com) (209.85.166.193) by pb1.pair.com with SMTP; 10 May 2019 17:08:18 -0000 Received: by mail-it1-f193.google.com with SMTP id l7so9395375ite.2 for ; Fri, 10 May 2019 07:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sewd0XZZc1ihmlcOIwkNyIB6M4KP2o03As6fYQ1Xuak=; b=Git8eyqW2tbUk0z5qc60hT0TL6UCU3CMreP7VhW93rj4/z41VTTByeAjLYtg1h75lI q/6Xh9UfoqV5nAj7ztyjgyPdXmmyFm7estRjqcOSfJuP6tsxJihdZHGEv49GkIusH+fp NGBaNz9yh6Wp+Xa1mLf58FE5OfKzvoVtBro7YYsxveGuwmF06+OTzbJJgJQhvICHovcJ pnZE6GSK4VrXXYot+oE+bbSf6BgyzZh/zm2zTRIpDjnw+lJtf+xWg9X3hrWanZ/JS43V OSwbUJ9/aY5xRrtEyWN5iw7qiflZarqEgI3aH6z2r9k1rfyiEIjPwxP7Wq3S9cjn2FCg INPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sewd0XZZc1ihmlcOIwkNyIB6M4KP2o03As6fYQ1Xuak=; b=g1VjDHHV6scjaCbQDWYKhlkbjAn/TKUL/Tu1srdtHWWZcUclHnUxm1T/pru7g7ai1v eJJEY5ZK0VhqMB12yXdFfrRaAkM0tAJN03FkipXs5kvWl8aPol5I/MgZ5QWUq48L30iA PeDhSNuQ8dFtNFv1eT0BI96XSGY6h5i4dusNXmDoLHccGgSijrvTFEx4GxkYRXkLFn/F T9Vit9lyMiUrOUuoUQdA2csg2HyyXhdS63Wvczem0AkHb5IvIpK6X0w9JkKoulPm9Gf/ GJJc/AwBPXddFBlthlKEF2fO9l/OfHt3j0RN5xEc9l9Wn/Ot2Rhx01w9njqAxql9eejF Jjug== X-Gm-Message-State: APjAAAX7C6AQHT/Yth5tVud6Q+6A6UPYrVEeASksEkHnQQuB45oM6YYH DQcNEhHkOwrmEVYwo/YUGd5o/FvzbdzQm3RTGys= X-Google-Smtp-Source: APXvYqzF5dgLvbWjbowCIzWLmMdNARs+sv+0IIwxS7CuIS5yjMTOCu8bNPhKBpeVAB1+41+RP2DST+20p5+HFOhR6RE= X-Received: by 2002:a02:879a:: with SMTP id t26mr7646838jai.89.1557497577172; Fri, 10 May 2019 07:12:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 10 May 2019 16:12:31 +0200 Message-ID: To: Dustin Wheeler Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000d375b50588892943" Subject: Re: [PHP-DEV] PHP header files, restrict to declaring code only From: kjarli@gmail.com (Lynn) --000000000000d375b50588892943 Content-Type: text/plain; charset="UTF-8" On Fri, May 10, 2019 at 3:40 PM Dustin Wheeler wrote: > On Fri, May 10, 2019 at 9:15 AM Lynn wrote: > > > > 2. Certain features, can be restricted to php-header files only, meaning > it > > does not affect > > "normal" PHP files. This might open up a whole new range of syntax > > possibilities that > > are currently blocked, such as `@trigger_error()` vs `@Annotation()`. > > > > Hi Lynn, thank you for opening this discussion! > > Could you explain how the range of syntax you suggest (regarding > annotations) is currently blocked? I'm not challenging your claim; I > *personally* don't know and am interested. While certainly not > supported natively, comment-based "annotations" can be implemented in > user-land and processed via reflection (See doctrine-annotations[1]). > There has also been previous work and discussion in the annotation > space [2][3][4][5]. Based on my light reading, I couldn't find any > objections to annotations with side-effects, but I could see that as > an argument. However, I'm more curious what your perspective is. > Hi Dustin, Currently with Doctrine Annotations, inspired by that of Java as far as I know, the syntax would be ambiguous, at least until the closing semi-colon. I'm no expert on which syntax is or isn't possible, I remember this one being a potential issue and introducing complexity in the parser due to the silencing operator. ```php @SomeAnnotation() class {} // versus @SomeFunctionBeingSilenced(); class {} ``` You are correct that annotations are possible via user-land packages. I'm personally hoping to see this feature come to native PHP, making it possible to simplify the usage and possibly performance. I've been brainstorming around another feature to unify variable inspections, which would make annotation reading a whole lot simpler [1], but could also be done in Reflection. Annotations are my primary example for header files, as they share the same concept, they are declaring code only and they don't have side effects. > Personally, I really like the idea of being able to declare > "side-effect free" as a feature. I don't know if I prefer the idea of > a `phph` file, distinguished by extension (so I'm glad you mention > alternatives such as `declare`). That said, I think that's mostly from > shock and not wanting to ever go back to a world that included *.php4, > *.php5, *.phtml, etc. :) > I'm not sure if a `.phph` file extension is required for this feature to work, though it might simplify its implementation. While I certainly share your concern about multiple extensions, my experience with other languages makes me believe that this would not be much of an issue. With header files being an opt-in feature, it hopefully won't make php more complex for developers new to PHP. > Hope all is well, > > 1: > https://www.doctrine-project.org/projects/doctrine-annotations/en/latest/index.html > 2: https://wiki.php.net/rfc/annotations > 3: https://externals.io/message/82813 > 4: https://externals.io/message/64895 > 5: https://externals.io/message/64722 > > -- > Dustin Wheeler | Software Developer > NC State University > mdwheele@ncsu.edu > "If you don't know where you're going, it's easy to iteratively not get > there." > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Apologies for my previous message being top posted, I hope this message arrives in a better format! Regards, Lynn van der Berg 1: https://gist.github.com/linaori/af50c1692e3d360d2e550b05e6121e58#future-possibilities --000000000000d375b50588892943--