digitalmars.D.bugs - Issue
- bobef (17/17) Jul 17 2008 DMD 1.033:
- bobef (12/12) Jul 17 2008 Ultimately I want to be able to do something like this:
- Jarrett Billingsley (4/20) Jul 17 2008 Because the "a.f() == f(a)" only works for arrays and associative arrays...
- bobef (2/29) Jul 17 2008 Obviously. And why is that? If it is working for one primitive type I se...
- Bill Baxter (7/37) Jul 17 2008 It was originally just an unadvertised easter egg that it worked for any...
- bobef (3/43) Jul 18 2008 Grrr. Too bad things come down to Tango or D2, which is almost the choic...
- bobef (9/9) Jul 22 2008 Some more problems on this matter. This tries to invoke TST.ASD instead ...
- Jarrett Billingsley (11/21) Jul 22 2008 This is behaving correctly. Remember that "asd".ASD(5) is just sugar fo...
DMD 1.033: import tango.io.Stdout; void a(void delegate() dg) { dg(); } void b(char[][] bb) { Stdout(bb); } void main(char[][] argv) { //why: {Stdout(argv);}.a(); //this is not working argv.b(); //and this is working? } Regards, bobef
Jul 17 2008
Ultimately I want to be able to do something like this: bool silent(T,ARGS...)(T delegate(ARGS) dgTry,ARGS args) { try { dgTry(args); return true; } catch(Object o) return false; } delegate(whatever W){W.dosomething();}.silent(somevar); Prototype like programming is very nice :) Regards, bobef
Jul 17 2008
"bobef" <bobef nosmap-abv.bg> wrote in message news:g5o6c5$2is4$1 digitalmars.com...DMD 1.033: import tango.io.Stdout; void a(void delegate() dg) { dg(); } void b(char[][] bb) { Stdout(bb); } void main(char[][] argv) { //why: {Stdout(argv);}.a(); //this is not working argv.b(); //and this is working? }Because the "a.f() == f(a)" only works for arrays and associative arrays and not delegates.
Jul 17 2008
Jarrett Billingsley Wrote:"bobef" <bobef nosmap-abv.bg> wrote in message news:g5o6c5$2is4$1 digitalmars.com...Obviously. And why is that? If it is working for one primitive type I see no reason it shouldn't work for the rest.DMD 1.033: import tango.io.Stdout; void a(void delegate() dg) { dg(); } void b(char[][] bb) { Stdout(bb); } void main(char[][] argv) { //why: {Stdout(argv);}.a(); //this is not working argv.b(); //and this is working? }Because the "a.f() == f(a)" only works for arrays and associative arrays and not delegates.
Jul 17 2008
bobef wrote:Jarrett Billingsley Wrote:It was originally just an unadvertised easter egg that it worked for any type at all. It was not in the spec at all for a long time, but I guess since the experiment seemed to be a success, Walter decided to put it in. Making it work for all types is on the to-do list for D2.0. See WalterAndrei.pdf from the 2007 conference. Or watch the video (!). --bb"bobef" <bobef nosmap-abv.bg> wrote in message news:g5o6c5$2is4$1 digitalmars.com...Obviously. And why is that? If it is working for one primitive type I see no reason it shouldn't work for the rest.DMD 1.033: import tango.io.Stdout; void a(void delegate() dg) { dg(); } void b(char[][] bb) { Stdout(bb); } void main(char[][] argv) { //why: {Stdout(argv);}.a(); //this is not working argv.b(); //and this is working? }Because the "a.f() == f(a)" only works for arrays and associative arrays and not delegates.
Jul 17 2008
Grrr. Too bad things come down to Tango or D2, which is almost the choice to use any D library at all or D2, since most of them use Tango. This is bad situation. Regards, bobef Bill Baxter Wrote:bobef wrote:Jarrett Billingsley Wrote:It was originally just an unadvertised easter egg that it worked for any type at all. It was not in the spec at all for a long time, but I guess since the experiment seemed to be a success, Walter decided to put it in. Making it work for all types is on the to-do list for D2.0. See WalterAndrei.pdf from the 2007 conference. Or watch the video (!). --bb"bobef" <bobef nosmap-abv.bg> wrote in message news:g5o6c5$2is4$1 digitalmars.com...Obviously. And why is that? If it is working for one primitive type I see no reason it shouldn't work for the rest.DMD 1.033: import tango.io.Stdout; void a(void delegate() dg) { dg(); } void b(char[][] bb) { Stdout(bb); } void main(char[][] argv) { //why: {Stdout(argv);}.a(); //this is not working argv.b(); //and this is working? }Because the "a.f() == f(a)" only works for arrays and associative arrays and not delegates.
Jul 18 2008
Some more problems on this matter. This tries to invoke TST.ASD instead of .ASD : void ASD(char[] a,int b) { } class TST { this(){"asd".ASD(5);} void ASD(){} }
Jul 22 2008
"bobef" <bobef nosmap-abv.bg> wrote in message news:g64mei$1vu4$1 digitalmars.com...Some more problems on this matter. This tries to invoke TST.ASD instead of .ASD : void ASD(char[] a,int b) { } class TST { this(){"asd".ASD(5);} void ASD(){} }This is behaving correctly. Remember that "asd".ASD(5) is just sugar for ASD("asd", 5). Name lookup in D proceeds from the innermost scope, so the first ASD it finds, it tries to use. It's exactly the same as when you try to do something like: char[] toString() { return toString(someMember) ~ ", " ~ toString(otherMember); } and the compiler complains about not using the right params to toString.
Jul 22 2008