digitalmars.D.bugs - Problems with minTL with DMD 0.120 and various other issues
- Maxime Larose (42/42) Apr 18 2005 Trying to compile MinTL with DMD 0.120, compiler complains about bad
- Ben Hinkle (14/58) Apr 18 2005 MinTL is badly busted in dmd-120 and 121. I don't have a work-around (as...
- Maxime Larose (22/84) Apr 18 2005 At least, I know that minTL compilation problems weren't me. Glad I didn...
- Ben Hinkle (6/16) Apr 18 2005 Typically new dmd release are fine wrt backwards compatibility in my
Trying to compile MinTL with DMD 0.120, compiler complains about bad argument types all over... ex: with list.d it reports List not being List*, etc. I unfortunately don't have the verbose results here with me, but I could easily get them if no one else has seen this. Also, I don't know if this is a bug or not, but D seems a bit off when it comes to handling object references vs pointers. Ex: struct Node(T) { T value; Node(T) next; // this doesn't work _inside_ Node(T), although it works fine elsewhere // compiler says: Node(T) is a class... which is exactly what I want... } struct Node(T) { T value; typeof(this) next; // this works fine, but now next is a Node(T)* (a pointer) // I don't want a pointer, I want an object reference } I understand that under the hood a pointer and an object reference may be the exact same thing in D. However, this behavior is not very object-oriented like. With the second definition, one has to code to deal with pointers, whereas it would have been better to simply treat node.next as an object. The second structure definition (where next is a pointer) leads to: node.next = new TNode(int); // this doesn't compile. // Compiler complains about next being a pointer, so: node.next = &(new TNode(int)); // ugly hack This can't be right... With DMD 0.120: TNode(int) node; // node is not initialized... // I must initialize it manually: node = new TNode(int); // is this normal??? I read the doc many times, but it is unclear (or I've missed it) how D deals with these issues. This can't possibly be expected behavior. What I am missing?
Apr 18 2005
"Maxime Larose" <mlarose broadsoft.com> wrote in message news:d40vj6$1l94$1 digitaldaemon.com...Trying to compile MinTL with DMD 0.120, compiler complains about bad argument types all over... ex: with list.d it reports List not being List*, etc. I unfortunately don't have the verbose results here with me, but I could easily get them if no one else has seen this.MinTL is badly busted in dmd-120 and 121. I don't have a work-around (aside from using 119). I ping'ed Walter about the bug so I'm hoping he can fix things up for 122.Also, I don't know if this is a bug or not, but D seems a bit off when it comes to handling object references vs pointers. Ex: struct Node(T) { T value; Node(T) next; // this doesn't work _inside_ Node(T), although it works fine elsewhere // compiler says: Node(T) is a class... which is exactly what I want... } struct Node(T) { T value; typeof(this) next; // this works fine, but now next is a Node(T)* (a pointer) // I don't want a pointer, I want an object reference }Inside of a struct S "this" has type S*.I understand that under the hood a pointer and an object reference may be the exact same thing in D. However, this behavior is not very object-oriented like. With the second definition, one has to code to deal with pointers, whereas it would have been better to simply treat node.next as an object.A pointer to a struct and a reference to a class instance are very different in D and you can't cast one to the other.The second structure definition (where next is a pointer) leads to: node.next = new TNode(int); // this doesn't compile. // Compiler complains about next being a pointer, so: node.next = &(new TNode(int)); // ugly hack This can't be right...That does seem wierd. the "new" should return a pointer to a TNode!(int)With DMD 0.120: TNode(int) node; // node is not initialized... // I must initialize it manually: node = new TNode(int); // is this normal???Is TNode a struct or class? I can't tell from the snippets of code what you actually compiled to get the behavior above. If TNode!(int) is a struct then the statements "TNode!(int) node; node = new TNode!(int);" should be illegal..I read the doc many times, but it is unclear (or I've missed it) how D deals with these issues. This can't possibly be expected behavior. What I am missing?Complete code examples would help (at least they'd help me).
Apr 18 2005
At least, I know that minTL compilation problems weren't me. Glad I didn't spend too much time investigating... (the errors looked fishy - seemed to be a compiler thing). Does this happen often? (A new version of the compiler that doesn't compile previously compiling code) About the other stuff, I mixed class and struct. I think I did the tests with both and both had the same results, but now I'm not sure anymore... You right, I'll get complete code examples. (Don't have them available where I am right now...) Thanks, Max "Ben Hinkle" <bhinkle mathworks.com> wrote in message news:d4114r$1nbv$1 digitaldaemon.com..."Maxime Larose" <mlarose broadsoft.com> wrote in message news:d40vj6$1l94$1 digitaldaemon.com...(asideTrying to compile MinTL with DMD 0.120, compiler complains about bad argument types all over... ex: with list.d it reports List not being List*, etc. I unfortunately don't have the verbose results here with me, but I could easily get them if no one else has seen this.MinTL is badly busted in dmd-120 and 121. I don't have a work-aroundfrom using 119). I ping'ed Walter about the bug so I'm hoping he can fix things up for 122.itAlso, I don't know if this is a bug or not, but D seems a bit off whenobjectcomes to handling object references vs pointers. Ex: struct Node(T) { T value; Node(T) next; // this doesn't work _inside_ Node(T), although it works fine elsewhere // compiler says: Node(T) is a class... which is exactly what I want... } struct Node(T) { T value; typeof(this) next; // this works fine, but now next is a Node(T)* (a pointer) // I don't want a pointer, I want anbereference }Inside of a struct S "this" has type S*.I understand that under the hood a pointer and an object reference maydealthe exact same thing in D. However, this behavior is not very object-oriented like. With the second definition, one has to code tonode.nextwith pointers, whereas it would have been better to simply treatdifferentas an object.A pointer to a struct and a reference to a class instance are veryin D and you can't cast one to the other.aboutThe second structure definition (where next is a pointer) leads to: node.next = new TNode(int); // this doesn't compile. // Compiler complainsyounext being a pointer, so: node.next = &(new TNode(int)); // ugly hack This can't be right...That does seem wierd. the "new" should return a pointer to a TNode!(int)With DMD 0.120: TNode(int) node; // node is not initialized... // I must initialize it manually: node = new TNode(int); // is this normal???Is TNode a struct or class? I can't tell from the snippets of code whatactually compiled to get the behavior above. If TNode!(int) is a structthenthe statements "TNode!(int) node; node = new TNode!(int);" should be illegal..I read the doc many times, but it is unclear (or I've missed it) how D deals with these issues. This can't possibly be expected behavior. What I am missing?Complete code examples would help (at least they'd help me).
Apr 18 2005
"Maxime Larose" <mlarose broadsoft.com> wrote in message news:d4140h$1q62$1 digitaldaemon.com...At least, I know that minTL compilation problems weren't me. Glad I didn't spend too much time investigating... (the errors looked fishy - seemed to be a compiler thing). Does this happen often? (A new version of the compiler that doesn't compile previously compiling code)Typically new dmd release are fine wrt backwards compatibility in my experience. Every now and then one comes out that seems to tickle some sublte issues and dmd-120 was one of those releases, unfortunately.About the other stuff, I mixed class and struct. I think I did the tests with both and both had the same results, but now I'm not sure anymore... You right, I'll get complete code examples. (Don't have them available where I am right now...)no problem. You might also want to try dmd-119 just in case.
Apr 18 2005