Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78628 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5999 invoked from network); 4 Nov 2014 11:46:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Nov 2014 11:46:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 74.125.82.41 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 74.125.82.41 mail-wg0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:45801] helo=mail-wg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/52-27956-78CB8545 for ; Tue, 04 Nov 2014 06:46:15 -0500 Received: by mail-wg0-f41.google.com with SMTP id k14so13305292wgh.14 for ; Tue, 04 Nov 2014 03:46:12 -0800 (PST) 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:content-type; bh=aak42izaaFrwAfEhZNWZEmHc1XLw7a+hAQsizjRAjF8=; b=V0qqVrHw+MyPENS8zuhuTDF7wbaJreTEIscrKw+jUwnyI8HvugGGqZggEArjYLng+q ucFSAK3RlLq2LF56NQD2/vaZvGOh0HkoYOjPdOiiVYBEdr5NkRMdSBVbCXbzn/cgs4/o VjmEBuvFJ+RqH2F0rviv5uLdoiu+T9tjjEy4aGQCi/SgNz+M6+2/lSdcaDYhuEaw8QMo HZ/5Vap+BxNoVsTgo+17/A8vXPHERLJyTmiyDxZ4I/A47WIebN7tE0RmYhzY4aT6t2RU /bkPxCuO3I5LY76tS4nz4l3yCzTQIJMgkaFzl+RWGwojZhdIQg+Ph15Oo/PyTApGZvTu ItqA== X-Gm-Message-State: ALoCoQk9VD30bjGGOPHh1ygeCk9JfDS9CdkvrKtYIvq/AUy+Vu6qMdeXE+u+vIO3JNHiG0oPDFei MIME-Version: 1.0 X-Received: by 10.180.14.226 with SMTP id s2mr22991754wic.61.1415101572302; Tue, 04 Nov 2014 03:46:12 -0800 (PST) Received: by 10.194.240.137 with HTTP; Tue, 4 Nov 2014 03:46:12 -0800 (PST) X-Originating-IP: [77.11.105.157] In-Reply-To: References: <5457AF2F.90808@php.net> <5457BDB7.8070701@garfieldtech.com> <54589A8D.3020607@sugarcrm.com> Date: Tue, 4 Nov 2014 12:46:12 +0100 Message-ID: To: Pierre Joye Cc: Larry Garfield , Levi Morrison , PHP internals , Stas Malyshev Content-Type: multipart/alternative; boundary=f46d04138c9f89db87050707028a Subject: Re: [PHP-DEV] Annotation PHP 7 From: kontakt@beberlei.de (Benjamin Eberlei) --f46d04138c9f89db87050707028a Content-Type: text/plain; charset=UTF-8 On Tue, Nov 4, 2014 at 12:20 PM, Pierre Joye wrote: > > On Nov 4, 2014 8:54 PM, "Benjamin Eberlei" wrote: > > > > On Tue, Nov 4, 2014 at 11:28 AM, Pierre Joye > wrote: > >> > >> On Tue, Nov 4, 2014 at 4:21 PM, Stas Malyshev > wrote: > >> > Hi! > >> > > >> >> As I do consider personal tastes important, there are times where we > should > >> >> listen to our users. > >> > > >> > It would be nice to take "paving the walkways" approach, but last time > >> > we tried, IIRC we've got into something very over-engineered. Maybe if > >> > we try again with more restricted scope (i.e. not trying to put a DSL > >> > for describing arbitrarily complex data structures into it :) it would > >> > be more successful this time. > >> > >> All projects mentioned in this thread use: > >> > >> > http://doctrine-common.readthedocs.org/en/latest/reference/annotations.html > >> > >> That makes a pretty good base spec. > > > > > > Being the author I can say, the doctrine annotations project is way too > over-engineered/special-purpose to land in core. > > > > I agree with Stas that a much simpler approach is probably realistic. > > > > beginning pure speculation here, i see a short array like syntax like: > > > > [foo="bar", bar="baz", baz=["key": "value"]] > > function annotated_fn() {} > > > > Maybe even exactly short array syntax: > > > > ["foo"="bar", "bar"="baz", "baz"=["key": "value"]] > > function annotated_fn() {} > > > > Then $reflectionFunction->getAnnotations() returns an array. Various > PHP/Userland libraries and frameworks can then stick whatever symantic on > top that they want. > > Yes, that was what discussed last time too and makes perfectly sense. > > I only not sure about the syntax. I do not like that one f.e. not really > in phase with what exists (doctrine or other languages). > The problem with this simple approach is namespacing to avoid clashes, any solution to incoperates that introduces lots of complexity like allowing "new Annotation" inside the array definition. However I guess now that for example composer provides namespaces for packages, the community could come up with a convention to namespace by composer package name to allow something like: ["doctrine/orm": ["entity"]] class User { ["doctrine/orm": ["id", "generatedvalue", "column": ["type": "integer"]]] public $id; } The simplicity here is really key. Validation and mapping of this is much easier implemented in userland code. > Cheers, > Pierre > --f46d04138c9f89db87050707028a--