hi,

Great job, very well written proposal.

Quick notice: the readonly keyword work without being used with a
method (or the default getter/setter):

class A {
  public readonly propro;
}

The writeonly property (useful from time to time) is not supported by
default but using the custom definitions.

I'm all in favour of having that in PHP. However not in an immediate
future (ie 5.4) but the next major version.

Cheers,

On Mon, Nov 29, 2010 at 12:18 AM,  <presid...@basnetworks.net> wrote:
> 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
>
>



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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

Reply via email to