Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-22 Thread Chris van Dam
Dear internals, I really like the way Nikita describes the implementation. It is very consistent and easy to read. At least for me it is. I must say I'm very excited to see this implementation coming to PHP Kind regards, Chris van Dam Op 20-10-12 11:52 schreef Nikita Popov

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-21 Thread Levi Morrison
I would like to point out that in my mind `const` and `read-only` are not necessarily the same thing. Read-only means that from outside the class it cannot be modified; the internal class can change it whenever it wants. Const means that once the value is set it will NEVER change. Big difference.

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-21 Thread Levi Morrison
If for some reason you need to enforce that nobody inherits it and sets the property, then declaring a setter and issuing an error or exception would suffice. I meant to say declaring a `private or final setter`. Noticed that after I sent it. -- PHP Internals - PHP Runtime Development

RE: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-21 Thread Clint Priest
] [RFC] Accessors : read-only / write-only keywords If for some reason you need to enforce that nobody inherits it and sets the property, then declaring a setter and issuing an error or exception would suffice. I meant to say declaring a `private or final setter`. Noticed that after I

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-21 Thread Amaury Bouchard
2012/10/21 Levi Morrison morrison.l...@gmail.com I would like to point out that in my mind `const` and `read-only` are not necessarily the same thing. Read-only means that from outside the class it cannot be modified; the internal class can change it whenever it wants. Const means that once

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-21 Thread Amaury Bouchard
? -Original Message- From: Levi Morrison [mailto:morrison.l...@gmail.com] Sent: Sunday, October 21, 2012 10:26 AM To: Amaury Bouchard Cc: Nikita Popov; Clint Priest; internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords If for some reason you

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Amaury Bouchard
read-only = final set null; It begins to be verbose. As I said many times, why don't you want to use the const keyword? It already exists and is pretty well understood by everybody. 2012/10/20 Clint Priest cpri...@zerocue.com I had thought of a deviation on some of the ideas presented to

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Nikita Popov
On Sat, Oct 20, 2012 at 9:29 AM, Amaury Bouchard ama...@amaury.net wrote: read-only = final set null; It begins to be verbose. As I said many times, why don't you want to use the const keyword? It already exists and is pretty well understood by everybody. Could you maybe explain where

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Derick Rethans
On Sat, 20 Oct 2012, Amaury Bouchard wrote: read-only = final set null; It begins to be verbose. There is nothing wrong with being verbose. PHP has always been verbose, which IMO is a strong point of the language as it makes everything a lot easier to search for. cheers, Derick --

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Jazzer Dane
The usage of the syntax in C# is moderately unimportant. This is a different language, and property accessors are part of numerous languages - not just C#. That being said, it's not that big of a deal, as it seems that most people are in a consensus that we do not want to to be adding any sort of

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Stas Malyshev
Hi! get() { return $this-Hours; } final set NULL; It looks like some unobvious piece of magic - what exactly set NULL means? There's no obvious parsing of this thing for somebody that doesn't already know what the magic means. I'd rather have people implement a method throwing

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Jazzer Dane
I'll agree with you in regards to your analysis of Clint's proposed syntax. In terms of your questioning the idea around read-only, this is how I think about it: Class A created property accessor $z that you can not set. Class B can extend me just fine, but they can not alter that basic rule

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Nikita Popov
On Sat, Oct 20, 2012 at 11:31 AM, Jazzer Dane tbprogram...@gmail.com wrote: The final keyword is used, especially in sizable OOP applications. Claiming it supposedly isn't used very often anymore - even if it were true - is not an excuse to exclude the read-only-esque functionality in this RFC.

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Pierre Joye
On Sat, Oct 20, 2012 at 1:07 AM, Clint Priest cpri...@zerocue.com wrote: I had thought of a deviation on some of the ideas presented to get rid of read-only/write-only while still keeping the ability to maintain their effect, if we so decide that the feature is wanted. Here it is: class

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Jazzer Dane
Nikita, there appears to be a slight misunderstanding. You're initial email was worded in a way that I presumed you were attacking the final keyword entirely, not just final methods. You are correct in that many PHP frameworks don't have final *functions*. My pushing for the read-only

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Jazzer Dane
Nikita brought up a good point: There aren't all that many scripts that use final methods, which could very well be the same fate for final property accessor methods. Due to the very possible unpopularity of whatever magic syntax/keyword we could potentially come up with, we *could *alternatively

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Amaury Bouchard
2012/10/20 Nikita Popov nikita@gmail.com Could you maybe explain where exactly const would be used? Well const and read-only have the exact same meaning. You can replace one by the other. So why create a new keyword? Please don't forget that we do not use your foo:bar syntax, so where

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Stas Malyshev
Hi! Class A created property accessor $z that you can not set. Class B can extend me just fine, but they can not alter that basic rule that I laid out for my and all my children's property accessor $z: You can not set it. I'm fine with the idea of methods that are not overrideable, even

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Amaury Bouchard
2012/10/20 Derick Rethans der...@php.net There is nothing wrong with being verbose. PHP has always been verbose, which IMO is a strong point of the language as it makes everything a lot easier to search for. There is a confusion between being verbose and being explicit. PHP syntax is

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Clint Priest
Hey Rasmus, please try and keep these replies in the appropriate thread... I am in favor of eliminating the read-only/write-only keywords and implementing no special code to make what was read-only/write-only language enforced. I think the alternatives with final are just fine and good enough

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Lester Caine
Clint Priest wrote: Hey Rasmus, please try and keep these replies in the appropriate thread... And bottom post please ... I am in favor of eliminating the read-only/write-only keywords and implementing no special code to make what was read-only/write-only language enforced. I think the

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Galen Wright-Watson
On Sat, Oct 20, 2012 at 12:09 PM, Lester Caine les...@lsces.co.uk wrote: I am in favor of eliminating the read-only/write-only keywords and implementing no special code to make what was read-only/write-only language enforced. I think the alternatives with final are just fine and good

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-20 Thread Maciek Sokolewicz
On 20-10-2012 19:20, Clint Priest wrote: Hey Rasmus, please try and keep these replies in the appropriate thread... I am in favor of eliminating the read-only/write-only keywords and implementing no special code to make what was read-only/write-only language enforced. I think the

[PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-19 Thread Clint Priest
I had thought of a deviation on some of the ideas presented to get rid of read-only/write-only while still keeping the ability to maintain their effect, if we so decide that the feature is wanted. Here it is: class TimePeriod { private $Seconds; public $Hours { get() { return