digitalmars.D - property keyword
- Gzp (31/31) Sep 25 2009 Hello,
- Lars T. Kyllingstad (6/13) Sep 25 2009 Hello, and welcome! :)
- Lars T. Kyllingstad (3/17) Sep 25 2009 Late July and early August, that is.
- Gzp (2/2) Sep 25 2009 Thanks, i've found it.
- Chad J (1/1) Sep 25 2009 http://prowiki.org/wiki4d/wiki.cgi?DocComments/Property
- BCS (6/26) Sep 25 2009 Personally, while I agree there are issues with using using function dir...
Hello, I'm quite new to D, and it seems to be a great language for me. But I've some questions: 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; } // or optionally a cast like feature // it might induce some error // so the cast might not be possible here (just an idea) // //string get() { // return member.convertToString(); //} // //set( string value) { // member = value.convertToInt(); //} } int member; } ... Foo f; f.prop = 1; f.prop = "1";
Sep 25 2009
Gzp wrote:Hello, I'm quite new to D, and it seems to be a great language for me. But I've some questions: 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:Hello, and welcome! :) There was a HUGE discussion about this not so long ago. Check out the newsgroup archives for August and July -- it's all about properties... http://www.digitalmars.com/d/archives/digitalmars/D/index.html -Lars
Sep 25 2009
Lars T. Kyllingstad wrote:Gzp wrote:Late July and early August, that is. -LarsHello, I'm quite new to D, and it seems to be a great language for me. But I've some questions: 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:Hello, and welcome! :) There was a HUGE discussion about this not so long ago. Check out the newsgroup archives for August and July -- it's all about properties...
Sep 25 2009
http://prowiki.org/wiki4d/wiki.cgi?DocComments/Property
Sep 25 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 used.
Sep 25 2009