Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83118 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40251 invoked from network); 18 Feb 2015 20:45:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 20:45:59 -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 209.85.212.176 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:52504] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/89-25021-60AF4E45 for ; Wed, 18 Feb 2015 15:45:59 -0500 Received: by mail-wi0-f176.google.com with SMTP id h11so43753005wiw.3 for ; Wed, 18 Feb 2015 12:45:55 -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=5pBf0pTAcYQtpPKlpBjXVybHUw8Z+KofWJoXvhv7Dn4=; b=FT6cZkhAUO+EsuIXqtiy0tFfb4qE4RNiwDSNFlQ4U8Z78ujRoFGAvL3fDSpP9NphP8 nqebfycxFQs1lziTb/EoNGL9h/ViDAu0zhnzhmqhRALdM3l9RnZ5+BeN3InRT5ea93fJ GgH3aywjRtjNsYgZ3fDOyjSe6s9XUs+LlWhchSUXtiZV2YyiNl+X6YBLbKfSFzhCwfVO 0pNfYNjjplibstlB2f0W4G060JPZAlJSqyU0Q9D2PhOV+Ti/v6bLFoA3t3bjniHJlfxW MMVZdO5z2dBY3FEIhiqqMyhjs9KZcKwF5Ay2IgH4km10biGYz10Q76JwyBxeGqxFWWQs Sfaw== X-Gm-Message-State: ALoCoQkaNhh82nY8nDwydX31q2tlk44H75PsUonalKdvN9HfJuQ8n7Qmw2TiRa4M98S1xCI/Yt6C MIME-Version: 1.0 X-Received: by 10.194.185.9 with SMTP id ey9mr2000939wjc.135.1424292355673; Wed, 18 Feb 2015 12:45:55 -0800 (PST) Received: by 10.194.192.202 with HTTP; Wed, 18 Feb 2015 12:45:55 -0800 (PST) X-Originating-IP: [77.11.88.250] In-Reply-To: References: <02a101d04af9$507484f0$f15d8ed0$@php.net> <02ff01d04b72$abae34a0$030a9de0$@php.net> <032801d04b8d$8ff3dce0$afdb96a0$@php.net> Date: Wed, 18 Feb 2015 21:45:55 +0100 Message-ID: To: =?UTF-8?Q?Pavel_Kou=C5=99il?= Cc: "guilhermeblanco@gmail.com" , Dmitry Stogov , francois , Alexander Lisachenko , Nikita Popov , PHP Internals , Pierrick CHARRON , Pierre Joye , Zeev Suraski , Andi Gutmans , Joe Watkins , Yasuo Ohgaki , Sebastian Bergmann , Stanislav Malyshev , Rasmus Lerdorf Content-Type: multipart/alternative; boundary=047d7bd6adceeaa6ca050f62e730 Subject: Re: [PHP-DEV] Annotations in PHP7 From: kontakt@beberlei.de (Benjamin Eberlei) --047d7bd6adceeaa6ca050f62e730 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Feb 18, 2015 at 9:29 PM, Pavel Kou=C5=99il wro= te: > On Wed, Feb 18, 2015 at 7:28 PM, guilhermeblanco@gmail.com > wrote: > > Hi Dmitry, > > > >> Are you (and Doctrine team) interested in this annotation idea? > > > > I'd say that Benjamin nailed in our possible usage: > > > > > > class Foo { > > } > > > > Now I do feel we need to elaborate some sort of named parameters. > Doctrine > > tries to simplify a lot developer's life by using consistency in defaul= t > > mapping and only if the user wants to override default behavior he need= s > to > > override a given parameter. This means in a case where you're mapping a > > JoinColumn ( > > > https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mappin= g/JoinColumn.php > > ), > > you may only want to specify the onDelete=3D"CASCADE" operation instead= of > > name, referencedColumnName and many other parameters. > > Trying to map this in your default parameter passing, we'd have somethi= ng > > like: > > > > > [ > > new OneToOne("Address"), > > new JoinColumn(default, default, default, default, "CASCADE") > > ] > > )> > > public $address; > > > > As I said, named parameters make a lot of sense when mapping defaults. > > Now by looking at this syntax, I still think we're closer to a simple > array > > implementation (ReflectionClass::getMetadata(string $name)) and having > > something like: > > > > <[ > > "orm" =3D> [ > > new OneToOne("Address"), > > new JoinColumn(default, default, default, default, "CASCADE") > > ] > > ]> > > public $address; > > > > > > PS: We haven't even started on talking about overrides yet... =3D\ > > > > As a Doctrine user, I find this way worse than current state. This > syntax looks UGLY and contains a lot of useless clutter. And yeah, > adding named parameters to PHP be pretty helpful to make annotations > more readable. :( > This is in no way related, only by the choice of guilherme's syntax. You could pass an array of options to the constructor to simulate named easily. > > And to what Francois said ("Anyway, I don't like the OO features > people want to add everywhere. They can get strings and inject them to > OO, but that's not the role of the annotation layer, IMHO. I > definitely prefer the KISS approach."). What's exactly wrong with > doing annotations in an object oriented manner? Both Doctrine > Annotations and C# have them as objects, and it works well. Having > annotations as just array of expressions/strings/whatever and needing > another library to parse them is not really that great "upgrade" from > current state. :( > PHP is not primarily an OOP language. As a user of Doctrine you wouldn't need to care, because we would wrap it anyway in our current code. So it wouldn't matter. > > Regards > Pavel Kouril > --047d7bd6adceeaa6ca050f62e730--