Fixing const arrays

Jakob Ovrum jakobovrum at gmail.com
Mon Dec 12 07:07:15 PST 2011


On Monday, 12 December 2011 at 14:46:17 UTC, Andrei Alexandrescu 
wrote:
> On 12/12/11 6:49 AM, Manu wrote:
>> I think every opportunity should be taken to make important 
>> breaking
>> changes while the community is as small as it is.
>
> Changing from r.save to r.save() is NOT an important change. It 
> makes no semantic difference, marks no progress, and has no 
> consequence.
>
> Insisting on the current property semantics was a sizeable 
> mistake of this community, and I am sorry we gave into it.
>
>
> Andrei

The whole point of a property to begin with is to make it look 
like a field, which has two important implications: improves 
interchangeability with function access vs a field, and exploits 
the user's intuition associated with accessing fields.

It is in light of the second consequence that it makes a 
difference. This is nothing new; the style guides for properties 
in C# operate on the same basic principle: if it looks like field 
access, it should behave like field access. If the programmer 
sees just "r.save", he doesn't know whether it's a field or a 
property, and he shouldn't need to know, it should be fast and 
cheap, and return a consistent value. As far as I know, this 
isn't always true for save, which means it breaks with the user's 
intuition.

I don't know whether or not this is an important change, but it 
*does* have consequence, and the current property semantics (as 
enforced with -property) are definitely meaningful. The old 
situation where you could write complete nonsense code like 
`std.file.read = "foo.txt";` is far worse.


More information about the Digitalmars-d mailing list