Hello Marcus,
class x
{
public readonly $xyz;
protected readonly $abc;
}
Definitions:
- public readonly - outside class can only read, not write.
- protected readonly - subclass can only read, not write.
- private readonly - does not make sense - do not support.
How difficult would it be to build this into the PHP engine?
--
Best regards,
Jason mailto:[email protected]
Saturday, May 13, 2006, 5:27:34 AM, you wrote:
MB> Hello Etienne,
MB> Friday, May 12, 2006, 2:11:38 PM, you wrote:
>> Hi,
>> my 2c:
>> 1) it shouldn't replace the visibility definition: we could also have
>> protected readonly properties.
MB> same here visibility and read/write control are two seperate things.
>> 3) how would you check if the property if readonly ? Trying it could
>> result to a Fatal error as you wanted. You would then need a
>> isReadonly() method/function: the function call wouldn't be spared.
MB> We could add this to reflection api easily.
MB> Best regards,
MB> Marcus