Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83821 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30341 invoked from network); 25 Feb 2015 20:23:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 20:23:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.25 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.25 out1-smtp.messagingengine.com Received: from [66.111.4.25] ([66.111.4.25:59672] helo=out1-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/F2-12216-84F2EE45 for ; Wed, 25 Feb 2015 15:23:36 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3A8FF2110A for ; Wed, 25 Feb 2015 15:23:31 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 25 Feb 2015 15:23:32 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:message-id:date:from :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=5ZhdD29onmWuzNdd/2JLGL nChvk=; b=Jp586AyUDDlQT7Y5HbGYahVi+kcty4wLxBsnu09nw36U2Qt6BdGKoK yzjUHX/5MSuqcF0rZe/WXVvK6d5VIoL7WDeiMr7uOFJhVyNZjJsBBu9tPG5YPA/9 CUasckmAyjh+c+n7ZzW/4lkVcR80ScGjyNbWubhxFUPLIUHvg22Go= X-Sasl-enc: r67PLs84slW0JFyVyfVSbPgZcu/ao7o1KIARO1mpFgvj 1424895811 Received: from Palantirs-MacBook-Pro-7.local (unknown [63.250.249.138]) by mail.messagingengine.com (Postfix) with ESMTPA id BA63E6800D5 for ; Wed, 25 Feb 2015 15:23:31 -0500 (EST) Message-ID: <54EE2F43.3020108@garfieldtech.com> Date: Wed, 25 Feb 2015 14:23:31 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: <02a101d04af9$507484f0$f15d8ed0$@php.net> <02ff01d04b72$abae34a0$030a9de0$@php.net> <032801d04b8d$8ff3dce0$afdb96a0$@php.net> <54ED4F3E.3060901@garfieldtech.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Annotations in PHP7 From: larry@garfieldtech.com (Larry Garfield) On 2/25/15 5:45 AM, Peter Holák wrote: > 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řil 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řil >> >> >> If you look at the major projects and code in the wild, PHP is a primarily >> 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, document >> the class), extend it, and build meaningful functionality and defaults using >> an already well-known syntax and convention. >> >> --Larry Garfield Consistent top/bottom posting please... this is a bottom-posting-thread. And yes, I agree that we shouldn't make absence of an annotation-referenced class an error until the annotation is actually read. Until the annotations is used, the class shouldn't be loaded so it's ignored. --Larry Garfield