property keyword

BCS none at anon.com
Fri Sep 25 18:26:24 PDT 2009


Hello Gzp,

> Hello,
> 
> I'm quite new to D, and it seems to be a great language for me. But
> I've some questions:

Hi!

> Why is it good to treat functions as property, it make the code quite
> unreadable. With a simple property keyword the things were much clear,
> like:
> 
> class Foo {
> 
>   property prop {
>     int get {
>       return a;
>     }
>     set(int value) {
>       member = value;
>     }
>   }
>   int member;
> }

Personally, while I agree there are issues with using using function directly 
as properties, I think readability is one of the reasons that it it a GOOD 
idea. I find the current solution MORE readable than the C# like syntax you 
used.





More information about the Digitalmars-d mailing list