Sebastian - how's the parser going?
I've finished my patches to make attributes work as native PHP tokens.
You can get the code and read a discussion about the various possibilities for
implementation at
http://www.calligram.co.uk/oss/Attributes
I really hope we can come to a consensus on how to suppor this in PHP.
Duncan
Whew Duncan! That's VERY nice.
Anyways... Annotations (structured comments) vs. Attributes?
Here's my take:
Since annotations are comments, you can remove them without modifying
behavior. However, attributes are actually needed since they are
part of the code. If you remove the attributes, you're changing
behavior.
phpDoc comments are... comments! You can remove all comments in your
code and your script will run just as well when they did have
comments.
So, IMHO, attributes != annotations. They're two different beasts, for
different purposes.
--
Hendy Irawan
http://www.gauldong.net
http://dev.gauldong.net
Duncan McIntyre wrote:
In your example I fail to see how
@[ WidgetType("Select");
AllowableValues(array("Current","Savings")); ]
is different from the good old
var $WidgetType = "Select", $AllowableValues = array("Current", "Saving");
apart from looking weird and scary (-:C
Just my $.02,
- Chris
It's different because in your example there is no way of knowing that
$AllowableValues refers to $WidgetType.
You would have to explicitly code that relationship into every class which
needed to know it.
Duncan McIntyre wrote:
In your example I fail to see how
@[ WidgetType("Select");
AllowableValues(array("Current","Savings")); ]
is different from the good old
var $WidgetType = "Select", $AllowableValues = array("Current", "Saving");
apart from looking weird and scary (-:CJust my $.02,
- Chris
Duncan
Duncan McIntyre wrote:
It's different because in your example there is no way of knowing that
$AllowableValues refers to $WidgetType.
My solution would be
var $attributes = array(
'accountType' => array(
'Type' => "Select",
'AllowableValues' => array("Current","Savings")
)
);
with a central attribute definition or alternatively
var $attributes_accountType = array(
'Type' => "Select",
'AllowableValues' => array("Current","Savings")
);
But then again I think the whole thing is typical OO bloat anyway and
that's why I don't want to have language features added for it (-:C
Over and out,
- Chris
Duncan McIntyre wrote:
Sebastian - how's the parser going?
Have a look at
http://pear.php.net/pepr/pepr-proposal-show.php?id=237
--
Sebastian Bergmann http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69