Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94299 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56318 invoked from network); 28 Jun 2016 14:12:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2016 14:12:39 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.53 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.53 mail-wm0-f53.google.com Received: from [74.125.82.53] ([74.125.82.53:37990] helo=mail-wm0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/C1-41838-4D582775 for ; Tue, 28 Jun 2016 10:12:36 -0400 Received: by mail-wm0-f53.google.com with SMTP id r201so29892699wme.1 for ; Tue, 28 Jun 2016 07:12:36 -0700 (PDT) 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; bh=vksrNDGoAfJhzU6LQ7Ee6wlYJjughEvGtoDl7UFwfeI=; b=yjLf3pe/o+36Vq2CMI1UZcLKgCCI5Kr35dFwoTclQIsQucS5zROvq41pTlZkVtEQM5 eRNvukSHmMJynXkKTsVXfoIhAJni3/rUX4Dvw0mFPcBwC1M+xDiMOqGorB5fJZQVPh1y Urt2yYKhvw1PFXm1oNSz+PZNkWtM6OVXdOl6cxKcVbr3em1VqajIfbiEarIuvfVORNYy gJL+1mByuuRNW7wziia4zrNUTt6D+6ckwmDY6jmeo64nIK5OH7fo2hadAP4NWtUZNESG O2Uo3QQ2cleehxU6o+GmAL1DYyVj3QH26MMfWNroFMsBQJI9SEKMcoCQZtrKpvzpL5sd DArg== 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:from:date :message-id:subject:to:cc; bh=vksrNDGoAfJhzU6LQ7Ee6wlYJjughEvGtoDl7UFwfeI=; b=caYzT/nTujB5o3HGsTjQ0MkF/v9umKXIgPyBeyf5DjucFuRFnX2X8e9VsaYGVkDnaX xGJ5CaDIRUT8AOZY2mw05S/lcTL7X6GxTprOa9GYWL4LgJnQ5bc8XTS44NUxk6ds3vAs O8CAIIdGzkP8OizAy8SYrK5eGShBpAEh1s0FetkBIT9p3UVrRO7VFdZ2yHPZYMWaVKNS aZKmIo2B1/WICGxt8jpZR7IGavkwCWpciNTy9cI9DaaG4smjUaWjGL748tIEoISBoKrH CIeWGmbFAB0DqwioVKBoUhriCLv3j/PLtSfRQnHGv098Ycozo8pV/P5bNt4zfLtTvKUS y/Pg== X-Gm-Message-State: ALyK8tJXd0I/qysBg0iskGtJAhE11dLSaPe+FowGxPqCuVdosGRWQ7EMHMPzCOwxRdKXPYTla8iM6EoV4mGE5w== X-Received: by 10.28.126.195 with SMTP id z186mr16670486wmc.95.1467123152186; Tue, 28 Jun 2016 07:12:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.123.104 with HTTP; Tue, 28 Jun 2016 07:12:12 -0700 (PDT) In-Reply-To: References: <211db59e-9c22-6df4-1f72-66ebbc5095bd@fleshgrinder.com> Date: Tue, 28 Jun 2016 16:12:12 +0200 Message-ID: To: Rasmus Schultz Cc: PHP internals Content-Type: multipart/alternative; boundary=001a114174e053f7280536573ac4 Subject: Re: [PHP-DEV] [RFC] Simple Annotations From: ocramius@gmail.com (Marco Pivetta) --001a114174e053f7280536573ac4 Content-Type: text/plain; charset=UTF-8 Hi Rasmus, On 27 June 2016 at 20:37, Rasmus Schultz wrote: > Tonight I started trying to write a proposal for even more simplified > annotations, e.g. something simple enough that it cannot result in > fatal errors. I eventually gave up, and here's why. > > Essentially, if you have to restrict yourself to things that cannot > under any circumstances error out, the only things you can use are > constant scalar values - even constant scalar expressions could not be > allowed, because even those could error when CONST_NAME or > Class::CONST_NAME aren't defined. > > So, in a nutshell, what you're saying (Richard) is that annotations > can only consist of scalar values, and possibly arrays of values? (and > I don't even see your gist doing that - it's just invoking closures, > as far as I can tell, and any of those could error, or not?) > > So, regardless of syntax, literally the only annotation data allowed > would be blatantly simple things like: > > ["max_length" => 20] > > ["data_type" => "int"] > > Or in other words, constant arrays, int, string, float and bool > values. Nothing else. > > Nothing can depend on any kind of external symbol (class names, > constants, etc.) since any such reference can cause an error. > > No static analysis or type-checking of any kind can ever be performed > - no assertions or declarations can be made about the shape or types > of metadata, at all. > > The problem is, that's simply not useful. > That's actually what doctrine/annotations has been for a while tho, and a lot of people rely just on that. The data-structure is still enforced by a VO-style class (the annotation itself) in the library, though. It would still be very useful, in my opinion. Note that the existing annotation libs out there do indeed trigger autoloading for referenced class constants. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --001a114174e053f7280536573ac4--