D - opCall bug
- Mik Mifflin <mik42 NOadelphiaSPAM.net> Feb 19 2004
- Andrew <Andrew_member pathlink.com> Feb 19 2004
- "davepermen" <davepermen hotmail.com> Feb 19 2004
- Andrew <Andrew_member pathlink.com> Feb 20 2004
- Mik Mifflin <mik42 NOadelphiaSPAM.net> Feb 20 2004
- Andrew <Andrew_member pathlink.com> Feb 20 2004
- Mik Mifflin <mik42 NOadelphiaSPAM.net> Feb 19 2004
- Manfred Nowak <svv1999 hotmail.com> Feb 19 2004
- Mik Mifflin <mik42 NOadelphiaSPAM.net> Feb 19 2004
- Manfred Nowak <svv1999 hotmail.com> Feb 19 2004
The following program doesn't compile:
class caller {
caller opCall (out int i) {
i = 10;
return this;
}
}
void main (char[][] args) {
caller c = new caller;
int x,y;
c(x)(y);
}
It gives this error:
opcall.d(11): declaration main.x is already defined
Compiler bug? Or did I do something stupid?
--
- Mik Mifflin
Feb 19 2004
In article <c133a2$1cun$1 digitaldaemon.com>, Mik Mifflin says...void main (char[][] args) { caller c = new caller; int x,y; c(x)(y); <<----: } |
HERE I don't think you can chain a function or opCall in that manner... The following works fine... void main (char[][] args) { caller c = new caller; int x,y; c(x); c(y); }
Feb 19 2004
you should be able to do that. done similar things yet.. i'll have a closer look... uhm.. tomorrow.. "Andrew" <Andrew_member pathlink.com> schrieb im Newsbeitrag news:c13739$1jlt$1 digitaldaemon.com...In article <c133a2$1cun$1 digitaldaemon.com>, Mik Mifflin says...void main (char[][] args) { caller c = new caller; int x,y; c(x)(y); <<----: } |
HERE I don't think you can chain a function or opCall in that manner... The following works fine... void main (char[][] args) { caller c = new caller; int x,y; c(x); c(y); }
Feb 19 2004
In article <c138s9$1n7c$1 digitaldaemon.com>, davepermen says...you should be able to do that. done similar things yet.. i'll have a closer look... uhm.. tomorrow..
IC. Could you please explain some of the advantages and disadvantages of doing things this way? Other than being able to simultaneously assign a value to multiple variables, what are some other uses for this feature? Thanks, Andrew
Feb 20 2004
Andrew wrote:In article <c138s9$1n7c$1 digitaldaemon.com>, davepermen says...you should be able to do that. done similar things yet.. i'll have a closer look... uhm.. tomorrow..
IC. Could you please explain some of the advantages and disadvantages of doing things this way? Other than being able to simultaneously assign a value to multiple variables, what are some other uses for this feature? Thanks, Andrew
I don't think the point is if anyone actually has a use for it, the point is that it should work, and does not. -- - Mik Mifflin
Feb 20 2004
In article <c15bp3$2k3l$1 digitaldaemon.com>, Mik Mifflin says...Andrew wrote:In article <c138s9$1n7c$1 digitaldaemon.com>, davepermen says...you should be able to do that. done similar things yet.. i'll have a closer look... uhm.. tomorrow..
IC. Could you please explain some of the advantages and disadvantages of doing things this way? Other than being able to simultaneously assign a value to multiple variables, what are some other uses for this feature? Thanks, Andrew
I don't think the point is if anyone actually has a use for it, the point is that it should work, and does not. -- - Mik Mifflin
I completely understand that Mik. I simply wanted to expand my knowledge. Thanks anyhow. Andrew
Feb 20 2004
Andrew wrote:In article <c133a2$1cun$1 digitaldaemon.com>, Mik Mifflin says...void main (char[][] args) { caller c = new caller; int x,y; c(x)(y); <<----: } |
HERE I don't think you can chain a function or opCall in that manner... The following works fine... void main (char[][] args) { caller c = new caller; int x,y; c(x); c(y); }
I can in this instance, as I return a caller object. -- - Mik Mifflin
Feb 19 2004
Andrew wrote: [...]The following works fine...
However, a very misleading error message. So long.
Feb 19 2004
Mik Mifflin wrote:The following program doesn't compile: class caller { caller opCall (out int i) { i = 10; return this; } } void main (char[][] args) { caller c = new caller; int x,y; c(x)(y); } It gives this error: opcall.d(11): declaration main.x is already defined Compiler bug? Or did I do something stupid?
A temporary workaround is '(c(x)(y))', with the extra parentheses. The error goes away and it works as expected.. -- - Mik Mifflin
Feb 19 2004
Mik Mifflin wrote:A temporary workaround is '(c(x)(y))', with the extra parentheses. The error goes away and it works as expected..
This is a cool thing. I am searching for something like that in the thread `[experts] opComma'. `cast(void) c(x)(y)' also works. So long.
Feb 19 2004









Andrew <Andrew_member pathlink.com> 