Re: Attributes/Annotations Case Study: Drupal

From: Date: Sat, 30 Apr 2016 22:45:26 +0000
Subject: Re: Attributes/Annotations Case Study: Drupal
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-93009@lists.php.net to get a copy of this message
Hi! > What would prevent the class from having methods? > > class MyAnnotation > { > public $foo; > public $bar; > public function doStuff() { ... } > } Oh, of course you can have methods, but then it is strange conceptually - you have a normal class, which some other part of the language just uses for something else that classes are not routinely used for. I.e., does it call a constructor? When? With which arguments? What if it fails? What if I just create an object of this class - would it be the same as annotation object? How the "multiple annotations" syntax in RFC would work - what <<test(1,2)>> means - one object with two parameters or two objects with one parameter? What <<test($a + $b > 0)>> actually gets? Maybe that should work but all these should be then defined. > I don't see any more need for multiple inheritance here than in any > other class definition. There kind of is if we want annotations to have additional capabilities as annotations - e.g. the AST things. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#93009) next »