Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93081 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95222 invoked from network); 5 May 2016 06:48:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 May 2016 06:48:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.181 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.181 mail-pf0-f181.google.com Received: from [209.85.192.181] ([209.85.192.181:34569] helo=mail-pf0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/38-16256-0CCEA275 for ; Thu, 05 May 2016 02:48:34 -0400 Received: by mail-pf0-f181.google.com with SMTP id y69so34107173pfb.1 for ; Wed, 04 May 2016 23:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=mEavPlqLXV4NGN5Pke3moKYBp7VRRbv4xhSRDCPaXQw=; b=SJVLf3kQhshuEfWBGlJhFYTaaUxvm2cUyUp+8Bm8gEv6y73SQEC5ePjUSk+Z9cZWMX +8AAD/ntIFEYnBYv0/pS01ec8b38vU+mtEmL1zuNTMrbf4OecLJeMvkh99o1SeVmFtl3 lS5+b/dmBpcCshWA2t2zTzo7VXq7dJNnG3O2Pvk/JuyUoIdsEuSIEKamKmA1D2qXbcPT mYrqAQqxvLLCIxMz8ImoNhVipD03SbPJdKJcbvxMVZiTSQhkWEbnReQgj9bp3GmbyB1G JK47fPnUMBxL8YB4OqzocQqdmbbgO4wzD1klbcjCTeIQSqYUFxHYHsPvcL+mn8O6jEKm zkTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=mEavPlqLXV4NGN5Pke3moKYBp7VRRbv4xhSRDCPaXQw=; b=ZhvAOaD8pt8r8p+/6taWr9cwC82QqFSeW1FtarjT3ETdbYJWxJq4LMX5Qg+4ld4AHv 7fQxPnLHwWZalLujCXiGWuIeKRT4OkEsMPSiMXzvea9XqWYkayX7L+nXFMcTikS8Bkq8 IlH23ZVypfFsU/lz3Wns93jCNz/ZcsVomn4lLJy4f3Z9sJ+uDimmA9cRv4+iMswMeIPl atE0JW/5+5E2FEowV+CXJwUY9ijIqNfHtEaDgldXOO/B1BzoNQFYmYNos50VbwsUtg+H m9PoEsh9y+YezeTKu7KaODi0GhnQTY6sGWWq4QZ6uJFMl1lv46ZmFbdirLCUZXmFL8m8 pXQg== X-Gm-Message-State: AOPr4FX+swbqnj+bxotGkmX7yxQW2lnaIbBkahf+h83Rf52RyKGzlDX+o8iuNa/6jISS2A== X-Received: by 10.98.102.74 with SMTP id a71mr18108035pfc.139.1462430909642; Wed, 04 May 2016 23:48:29 -0700 (PDT) Received: from [192.168.2.102] (76-220-46-95.lightspeed.sntcca.sbcglobal.net. [76.220.46.95]) by smtp.gmail.com with ESMTPSA id q70sm10660009pfj.81.2016.05.04.23.48.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 04 May 2016 23:48:27 -0700 (PDT) To: Dmitry Stogov , Larry Garfield , 'PHP internals' References: <5723F2AE.2020806@garfieldtech.com> Message-ID: <8a7d1e8a-1e9e-0bbd-912a-21201638b989@gmail.com> Date: Wed, 4 May 2016 23:48:21 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Attributes/Annotations Case Study: Drupal From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > It's also possible to write: > > < "id" = "system_branding_block", > "admin_label" = @Translation("Site branding") > ]))>> > > > you don't need to split your annotation into many attributes. You should > just adopt its syntax to become a valid PHP expression. > This expression is not going to be evaluated. It's going to be just > parsed into AST. and then you may traverse this AST and transform it > into other data structures. > The key idea of RFC was not to invite another language for meta-data, > but use PHP language itself. This is a good way to avoid handling a lot of issue, but what I am afraid of is that with this solution, what would happen that people start doing exactly that - inventing another languages for metadata. In fact, that's exactly what the expression above does - it uses "=" as named argument, and uses @ as special tag, not like PHP does. So it's in fact mini-language using PHP's AST parser to tokenize its grammar, but having separate semantics. Maybe that's what we want to have here - freedom for everybody to invent their own languages - but I fear the danger of fragmentation here and also people implementing tons of slightly different incompatible parsers for ASTs that are generated. We'd have Drupal attributes and Symphony attributes and Doctrine attributes and Zend attributes and so on, and each of them would have different semantics. Not sure this would be good. But maybe it avoids arguing about the syntax now. > we don't have fully constructed classes at compile time. Classes may be > used during transformation from plain arrays and AST into application > specific data structures. We don't have classes but we do namespace resolution right? For namespace resolution, you don't need to have the class actually present. I don't think we need it for ::class either. -- Stas Malyshev smalyshev@gmail.com