Gustavo's message pretty much expresses exactly how I feel.
As an extension, I feel that as long as annotations don't slow down
existing non-annotated code (or code using the ridiculous phpdoc
parsing), then I see no reason to keep annotations from being added.
People argue that the new syntax is bad and confusing to beginners. As
someone who did their first programming in any language in 2006 in PHP,
OOP confused the heck out of me. I knew the pros used it, but also knew
I wasn't a pro. So I ignored it. I didn't say how crazy PHP is for
having these wild things called "classes" that I didn't understand. As I
became more experienced with PHP, I started to understand classes. Then
I figured out that classes *are* useful, so I started using them.
Also, for the record, I didn't even know what a PHP framework was when I
started PHP, and even when I found out, I never thought that looking
through it might be the best way to learn something (this is different
now of course, but I am a much more experienced developer presently).
I think the most troublesome thing from my point of view is the fact
that it makes PHP just that much more complicated. However, I don't
think this is a huge issue because annotations are fairly simple, yet
quite powerful.
On an unrelated note, I really wish the [] syntax for arrays was put in,
because:
1. It is easier to type. (subjective)
2. It is easier to read. (subjective)
3. When developing a web app, having the similar syntax is nice.
4. I never understood the argument that they would be unclear.
Javascript does it the [] (and they still have the new Array() method too).
However, that is all behind us (unfortunately, I missed that arugment :( )
I hope annotations make the cut for whatever the next release of PHP is.
On 9/15/2010 6:34 PM, Gustavo Lopes wrote:
On Wed, 15 Sep 2010 23:00:15 +0100, Stas Malyshev
<smalys...@sugarcrm.com> wrote:
easy as possible for the sooner. In the case of the annotation, the
kids writing their websites won't use them, the learning curve remains
unchanged.
No, because they look at the framework code and when they see all this
{...@#!blah($...@blah=blah$^)]} they'd have hard time figuring out what
that means - unless we make it easy. I understood that common
consensus was even [1,2,3] is not easy enough - has that changed?
They won't look at framework code; they'll look at some random tutorial
about PHP+MySQL and write a program full of vulnerabilities :p
Do you really think they'll go see the source code for Symphony?... They
won't understand it as it is now.
Anyway, this is not even remotely comparable to [1,2,3]. One is mere
syntactic sugar (albeit easier on the keyboard and arguably more
readable) that solves the same problem as a construct we already have,
the other is actually new functionality, which happens to require new
syntax.
I agree that a language should be beginner-friendly; after all,
beginners will always be the majority of the users for any live language.
But can't we have a language that's easy to learn (you can start writing
programs in it very quickly), yet powerful, i.e., expressive?
Annotations are very expressive (please don't say "there are no use
cases"); they have a wide range of applications, from simplifying
configuration to making aspect oriented programming much cleaner.
From my experience when I first learned about annotations, the concept
is very easy to apprehend. What's difficult is to understand what they
can be useful for.
They can also be a bit dangerous because they may hide the code that's
actually being run. Whether that will be a problem or not, only the
future will tell. Still, I don't think it will be nearly as dangerous as
global variables or variable variables (or as other stuff we don't have,
like operator overloading).
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php