Properties

Nick Sabalausky a at a.a
Sat Jan 10 21:31:41 PST 2009


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:gkbtpo$1jq0$1 at digitalmars.com...
> Miles wrote:
>> Daniel Keep wrote:
>>> Yes, property syntax can simplify some cases, but this isn't one of 
>>> them.
>>
>> One good distinction properties and normal functions ought to make is
>> that functions should never be called without (), and properties should
>> never have () unless it has a function type.
>>
>> Current syntax allows crazy things like:
>>
>> ----------
>> exit = 1; // it is not an assignment
>> x = toString = getenv = "PATH"; // creepy, but valid D
>>
>> if (fork == 1) // not comparing the value of a variable
>> ----------
>
> Walter and I see eye to eye that a possible solution would be to only 
> allow the a = b syntax as an alternative for a(b) only if there's also a 
> function a(). All of the above can be fixed within that framework.
>

I think that's a big part of the problem though. The current strategy just 
leads to various fringe cases with their own specialized "solutions". I 
think we have sufficient reason to consider "implicit properties" a failed 
experiment. 





More information about the Digitalmars-d mailing list