Hello,

This is my first time using a mailing list, so please bear with me.

Some time back I suggested that PHP should have a property get/set syntax
similar to that of Microsoft's C# language.  One of the PHP developers
suggested that if I were serious about it, I should write an RFC.  I have
done just that, and I would now like to present my RFC to everyone here in
internals, in order to start a discussion on the topic.

The RFC:

Many modern languages have a special syntax for writing get/set method
pairs.  All that PHP currently supports is __get and __set, which while
great for writing generic get/set methods is nearly useless when it comes
to individual properties.  Our only other choice is the age old process of
writing custom class methods to make our get/set methods.  Not only does
this lack any kind of uniformity, but it also complicates the syntax
($foo->getBar() and $foo->setBar('baz') instead of $foo->bar and
$foo->bar='baz').  I believe that if PHP is going embrace modern
object-oriented design, including encapsulation, than it needs a modern
solution to property getters and setters.

I wont add much more here, but rather let the RFC itself do the talking. 
It is fairly well fleshed out, and should explain everything clearly
enough.

Link to the RFC:
http://wiki.php.net/rfc/propertygetsetsyntax

Thanks,
Dennis Robinson


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

Reply via email to