Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83771 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8500 invoked from network); 25 Feb 2015 11:45:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 11:45:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=peterholak@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=peterholak@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.51 as permitted sender) X-PHP-List-Original-Sender: peterholak@gmail.com X-Host-Fingerprint: 209.85.216.51 mail-qa0-f51.google.com Received: from [209.85.216.51] ([209.85.216.51:52527] helo=mail-qa0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/49-62407-0F5BDE45 for ; Wed, 25 Feb 2015 06:45:52 -0500 Received: by mail-qa0-f51.google.com with SMTP id i13so2208674qae.10 for ; Wed, 25 Feb 2015 03:45:50 -0800 (PST) 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 :content-type:content-transfer-encoding; bh=itLmahhp9KVU7Fn78+fR1fnIavA63DRJQ0/0PIcMhi4=; b=YJn52fP7qUA84L3R6TBwzv6H1vxz2OEQvuiktzjK2B+7ERqQyfDWfw8pX1PlSOHEmK 1DRCoplEPeuvqVGcvtEZv1IxsITSaYip1BT9/MHcF0nkfZd99zaCz7JDbtz/qJabtd/P yBQX0Lv+1w1X3taPBABHIPAKtFCYR2JxCGrJISTpLJpMbWAdmMqADsIcogbvSthDWr/2 zZ7xc+F7IzWMeGclnqm1leFoJv+L5saC5mj4J/SujARJKSLB/aI56wUMCufDsC7ZBPP6 aaxQ3ma5xNXihCTBLZaiZQFM1YMjOtCTzmALVqOMClUV5zo7ys7GjA8ZFcF2SOU/rtW6 S2Jw== X-Received: by 10.140.44.69 with SMTP id f63mr5677924qga.3.1424864750307; Wed, 25 Feb 2015 03:45:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.106.74 with HTTP; Wed, 25 Feb 2015 03:45:29 -0800 (PST) In-Reply-To: <54ED4F3E.3060901@garfieldtech.com> References: <02a101d04af9$507484f0$f15d8ed0$@php.net> <02ff01d04b72$abae34a0$030a9de0$@php.net> <032801d04b8d$8ff3dce0$afdb96a0$@php.net> <54ED4F3E.3060901@garfieldtech.com> Date: Wed, 25 Feb 2015 12:45:29 +0100 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Annotations in PHP7 From: peterholak@gmail.com (=?UTF-8?B?UGV0ZXIgSG9sw6Fr?=) One thing to consider when annotations are classes is whether using an annotation should make the annotated class depend on the annotation classes it uses. In other words, would a missing annotation class produce an error? It doesn't in Java (at runtime, see http://stackoverflow.com/a/3567969) and I think they made the right choice on that (although you can't compare this directly to PHP due to the nature of compilation in Java, and it is still a compile error there). Consider an entity class with Doctrine mappings in annotations. This class is still perfectly usable on its own without this persistence information (assuming you don't care about database persistence in such situations), just as it would be if the mapping information was in XML/YAML files instead. I don't think Doctrine should be a hard dependency of such a class. Of course the code that _reads_ the annotations still depends on the annotation classes it cares about. 2015-02-25 5:27 GMT+01:00 Larry Garfield : > On 02/21/2015 03:35 PM, Pavel Kou=C5=99il wrote: >> >> >> I know you could wrap it in your code, but that would still mean there >> would probably be multiple implementations of Annotations in the >> "wild", instead of a good complete functionality in the language >> itself. >> >> I know PHP is not primarily an OOP language, but Annotations IMHO make >> sense as classes, so I don't see any reason why would it be bad to >> make them in that way. Also, making Annotations be classes won't >> magically turn PHP into a primarily OOP language? >> >> Regards >> Pavel Kou=C5=99il > > > If you look at the major projects and code in the wild, PHP is a primaril= y > OOP language and has been for years. It's multi-paradigm but OOP is the > dominant style in the wild today. > > And I think mapping annotations to classes is a fine idea, as it means I = can > very easily document what a given annotations is for (it's a class, docum= ent > the class), extend it, and build meaningful functionality and defaults us= ing > an already well-known syntax and convention. > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >