On 16/11/10 21:56, Alec wrote:
> [snip]
>
> attribute RestMethod('/do/something', 'Do Stuff', 'Does something.',
> array(
>     'arg1' => 'A cool argument!'
> ));
> public static DoSomething($arg1) {
> ...
>
> or
>
> attribute Example('arg', 'arg2', 3, (time() > 0 ? true : false));
> class Demo {
> ...
>
> That way it is clear that that line is an attribute. If the person
> doesn't know what an "attribute in PHP" is, they can Google it.
>
> This does the following:
> - No new branch of syntax is introduced like C# style annotations or
> parsed docblocks would. The syntax is very similar to standard PHP
> (the only thing missing is the "new" before the class name, and the
> only new thing is the word "attribute")
>
> - This doesn't add significant complexity. It essentially makes
> attributes autocalled class constructors. (As a side note, I don't
> think any part of PHP is significantly complex, it just isn't
> consistent--making it seem complex).
>
> - It is quite clear that that line is an attribute. People will be
> able to easily Google, find and read the PHP docs for an explanation.
As a karma-less user, I actually quite like this syntax and it feels
very PHP-like to me. Making it trivially easy for people to search for
the explanation of a feature is an excellent idea.


Dave

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to