D.gnu - Properties implemented in DLI?
- Brad Beveridge (18/18) Jan 17 2003 Hi guys. I'm playing with D at the moment, it's quite nice. I'm
- Ilya Minkov (7/29) Jan 17 2003 Does your class really look like that?
- Brad Beveridge (18/57) Jan 17 2003 That's what I originally thought too, but according to the sample code
- Ilya Minkov (4/73) Jan 17 2003 Damnit, i was looking at the very same piece of code in the manual, and
- Burton Radons (4/17) Jan 17 2003 Properties support is in the very latest version
- Brad Beveridge (2/24) Jan 17 2003
Hi guys. I'm playing with D at the moment, it's quite nice. I'm checking out properties, ie.. class Mytest { int tmp; void tp(int newTmp) { printf("assigning tmp\n"); tmp =newTmp;}; int tp() { printf("getting tmp\n"); return tmp;}; } but DLI gives me the following errors test.d(48): Error: cannot implicitly convert int to void(int newTmp) test.d(49): Error: cannot implicitly convert void(int newTmp) to int Is this a problem in my code, lack of implementation in Walter's frontend or a missing section in DLI? If it is a DLI issue could someone point me to a place to look to implement it? Cheers Brad
Jan 17 2003
Does your class really look like that? haven't you forgotten a little thing? did you try to compile the piece you're sending? here the identifiers simply don't match. i've marked them below. Brad Beveridge wrote:Hi guys. I'm playing with D at the moment, it's quite nice. I'm checking out properties, ie.. class Mytest { int tmp;^^^tmp!!!void tp(int newTmp) { printf("assigning tmp\n"); tmp =newTmp;}; int tp() { printf("getting tmp\n"); return tmp;};^^ tp!!!}but DLI gives me the following errors test.d(48): Error: cannot implicitly convert int to void(int newTmp) test.d(49): Error: cannot implicitly convert void(int newTmp) to int Is this a problem in my code, lack of implementation in Walter's frontend or a missing section in DLI? If it is a DLI issue could someone point me to a place to look to implement it? Cheers Brad
Jan 17 2003
That's what I originally thought too, but according to the sample code in the D spec... class Abc { int myprop; void property(int newproperty) { myprop = newproperty; } // set'er int property() { return myprop; } // get'er } Personally I'd like to keep the property & it's setters/getters similar, but still different. If they're difference then I can more clearly know what I am trying to do - ie am I try to access the var directly, or though the property methods - I don't want the variable to exactly shadow the getters/settors. I suspect I will take a code style where my internal variables that are accessed through setters/getters have some kind of pre or postfix - ie _property or somesuch. Cheers Brad Ilya Minkov wrote:Does your class really look like that? haven't you forgotten a little thing? did you try to compile the piece you're sending? here the identifiers simply don't match. i've marked them below. Brad Beveridge wrote:Hi guys. I'm playing with D at the moment, it's quite nice. I'm checking out properties, ie.. class Mytest { int tmp;^^^tmp!!!void tp(int newTmp) { printf("assigning tmp\n"); tmp =newTmp;}; int tp() { printf("getting tmp\n"); return tmp;};^^ tp!!!}but DLI gives me the following errors test.d(48): Error: cannot implicitly convert int to void(int newTmp) test.d(49): Error: cannot implicitly convert void(int newTmp) to int Is this a problem in my code, lack of implementation in Walter's frontend or a missing section in DLI? If it is a DLI issue could someone point me to a place to look to implement it? Cheers Brad
Jan 17 2003
Brad Beveridge wrote:That's what I originally thought too, but according to the sample code in the D spec... class Abc { int myprop; void property(int newproperty) { myprop = newproperty; } // set'er int property() { return myprop; } // get'er }Damnit, i was looking at the very same piece of code in the manual, and didn't notice the identifiers here are different too... I guess i need to force myself to sleep more. sorry for misleading.Personally I'd like to keep the property & it's setters/getters similar, but still different. If they're difference then I can more clearly know what I am trying to do - ie am I try to access the var directly, or though the property methods - I don't want the variable to exactly shadow the getters/settors. I suspect I will take a code style where my internal variables that are accessed through setters/getters have some kind of pre or postfix - ie _property or somesuch. Cheers Brad Ilya Minkov wrote:Does your class really look like that? haven't you forgotten a little thing? did you try to compile the piece you're sending? here the identifiers simply don't match. i've marked them below. Brad Beveridge wrote:Hi guys. I'm playing with D at the moment, it's quite nice. I'm checking out properties, ie.. class Mytest { int tmp;^^^tmp!!!void tp(int newTmp) { printf("assigning tmp\n"); tmp =newTmp;}; int tp() { printf("getting tmp\n"); return tmp;};^^ tp!!!}but DLI gives me the following errors test.d(48): Error: cannot implicitly convert int to void(int newTmp) test.d(49): Error: cannot implicitly convert void(int newTmp) to int Is this a problem in my code, lack of implementation in Walter's frontend or a missing section in DLI? If it is a DLI issue could someone point me to a place to look to implement it? Cheers Brad
Jan 17 2003
Brad Beveridge wrote:Hi guys. I'm playing with D at the moment, it's quite nice. I'm checking out properties, ie.. class Mytest { int tmp; void tp(int newTmp) { printf("assigning tmp\n"); tmp =newTmp;}; int tp() { printf("getting tmp\n"); return tmp;}; } but DLI gives me the following errors test.d(48): Error: cannot implicitly convert int to void(int newTmp) test.d(49): Error: cannot implicitly convert void(int newTmp) to intProperties support is in the very latest version (http://www.opend.org/dli/arc/dli-0.1.2.tar.gz). I see that the menu bar on OpenD is still linking to 0.1.1, I'll have to fix that.
Jan 17 2003
Thanks, grabbing it now.. Burton Radons wrote:Brad Beveridge wrote:Hi guys. I'm playing with D at the moment, it's quite nice. I'm checking out properties, ie.. class Mytest { int tmp; void tp(int newTmp) { printf("assigning tmp\n"); tmp =newTmp;}; int tp() { printf("getting tmp\n"); return tmp;}; } but DLI gives me the following errors test.d(48): Error: cannot implicitly convert int to void(int newTmp) test.d(49): Error: cannot implicitly convert void(int newTmp) to intProperties support is in the very latest version (http://www.opend.org/dli/arc/dli-0.1.2.tar.gz). I see that the menu bar on OpenD is still linking to 0.1.1, I'll have to fix that.
Jan 17 2003