property / getProperty() / setProperty()

Nick Sabalausky a at a.a
Sat Aug 1 14:02:58 PDT 2009


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:h51q1b$lh8$1 at digitalmars.com...
> bearophile wrote:
>> Andrei Alexandrescu:
>>> Thanks. So it looks like get_property() and set_property() could fly. 
>>> How does that sound?
>>
>> Not too much good. Among the simpler solutions there's the 'property' 
>> attribute, that while not helping in reducing code (it makes code 
>> longer!) solves most problems, while being simple. It's the minimal 
>> solution that I think will work/fly.
>
> We can't throw keywords at problems like they're getting out of style. 
> I've noticed that here every little problem gets solved by a little 
> keyword. If not, some arcane new syntax. Nobody seems to care about 
> rewriting, which I think is best.
>

That's because most people don't think it's best. Your solution only 
addresses the user of the property. From that perspective, yes your 
rewriting approach works perfectly fine. But what you're (mostly) sweeping 
under the rug is the creator of the property. Properties are such a common 
idiom that their definitions shouldn't be such a verbose non-DRY 
pain-in-the-ass to read and create.

Additionally, I can't believe you're so steadfast about saving the three 
keystokes for '()' (even at the expense of creating certain unsolvable 
problems), and yet you seem to have no problem at all with the 
far-more-than-three extra keystrokes required by throwing away brevity and 
DRY when creating a property under the rewrite proposals. 





More information about the Digitalmars-d mailing list