digitalmars.D.announce - DMD 0.150 release
- Walter Bright (2/2) Mar 19 2006 I wanted to get the interface covariant problem fixed for the library gu...
- Jarrett Billingsley (4/6) Mar 19 2006 So.. what's changed? ;) (the changelog isn't updated)
- Jarrett Billingsley (3/4) Mar 19 2006 Scratch that, it just did.
- Jarrett Billingsley (4/5) Mar 19 2006 Sorry for posting so many times, but thank you so much for covariant
- Walter Bright (3/9) Mar 19 2006 You're most welcome.
- Chris Miller (4/14) Mar 19 2006 It sounded like you needed to use a trick to get this to work; is there ...
- Walter Bright (3/5) Mar 19 2006 Yes, it's 3 or 4 instructions.
- John Demme (3/7) Mar 19 2006 Walter, you're my hero! I'll have a look-see tomorrow, but I'm excited.
- John Demme (4/15) Mar 19 2006 I ran some tests earlier today, and I love it! This is great!
- John Reimer (3/9) Mar 19 2006 Excellent! I'm really glad this was fixed!
- Walter Bright (4/6) Mar 19 2006 You're welcome! I'm glad it's working. I thought it would be much harder...
- John Reimer (2/8) Mar 19 2006 Thank you. :)
- Lionello Lunesu (3/3) Mar 19 2006 Nice work!
- Nick (3/5) Mar 20 2006 Pardon my ignorance, but what is (was) "the interface covariant problem"...
- Walter Bright (3/7) Mar 20 2006 See the "interfaces :-(" thread over in digitalmars.D.dtl
- clayasaurus (2/8) Mar 21 2006 :)
- xs0 (3/6) Mar 21 2006 Out of curiosity - how did you implement it?
- Walter Bright (3/9) Mar 21 2006 The type returned by a virtual function is the type of its introducing
- xs0 (13/23) Mar 21 2006 Hmm, so casting between FooInterface[] and FooClass[] still doesn't
- Walter Bright (2/15) Mar 21 2006
- Kyle Furlong (2/25) Mar 22 2006 And the rest of the post...?
- Walter Bright (4/5) Mar 22 2006 Casting is a blunt instrument, you need to be careful with it. Disabling...
- xs0 (17/23) Mar 22 2006 So how come you can't cast a double to int delegate(int)? :P
- =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= (8/36) Mar 22 2006 Yes, if this is not "fixed", we certainly need some Java->D tutorials
- Stewart Gordon (14/21) Mar 22 2006 The same way in which covariantly overriding a class method is
- xs0 (15/28) Mar 22 2006 Well, there's quite a difference between classes and interfaces in
-
Stewart Gordon
(20/42)
Mar 22 2006
- xs0 (5/27) Mar 22 2006 I was just trying to say covariance is not done the same way with
- Stewart Gordon (34/41) Mar 23 2006 Yes, but UIMS it _is_ trivial for the bug that I've discovered is fixed.
I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.html
Mar 19 2006
"Walter Bright" <newshound digitalmars.com> wrote in message news:dvj3fi$2jb0$1 digitaldaemon.com...I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlSo.. what's changed? ;) (the changelog isn't updated) Man, I thought I was the only one up this late.
Mar 19 2006
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dvj3lk$2jg4$1 digitaldaemon.com...So.. what's changed? ;) (the changelog isn't updated)Scratch that, it just did.
Mar 19 2006
"Walter Bright" <newshound digitalmars.com> wrote in message news:dvj3fi$2jb0$1 digitaldaemon.com...I wanted to get the interface covariant problem fixed for the library guys.Sorry for posting so many times, but thank you so much for covariant interface returns.
Mar 19 2006
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dvj435$2k5p$1 digitaldaemon.com..."Walter Bright" <newshound digitalmars.com> wrote in message news:dvj3fi$2jb0$1 digitaldaemon.com...You're most welcome.I wanted to get the interface covariant problem fixed for the library guys.Sorry for posting so many times, but thank you so much for covariant interface returns.
Mar 19 2006
On Sun, 19 Mar 2006 03:37:07 -0500, Walter Bright <newshound digitalmars.com> wrote:"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dvj435$2k5p$1 digitaldaemon.com...It sounded like you needed to use a trick to get this to work; is there a runtime penalty?"Walter Bright" <newshound digitalmars.com> wrote in message news:dvj3fi$2jb0$1 digitaldaemon.com...You're most welcome.I wanted to get the interface covariant problem fixed for the library guys.Sorry for posting so many times, but thank you so much for covariant interface returns.
Mar 19 2006
"Chris Miller" <chris dprogramming.com> wrote in message news:op.s6n41na6po9bzi moe...It sounded like you needed to use a trick to get this to work; is there a runtime penalty?Yes, it's 3 or 4 instructions.
Mar 19 2006
Walter Bright wrote:I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlWalter, you're my hero! I'll have a look-see tomorrow, but I'm excited. ~John Demme
Mar 19 2006
I ran some tests earlier today, and I love it! This is great! Thanks, Walter ~John Demme John Demme wrote:Walter Bright wrote:I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlWalter, you're my hero! I'll have a look-see tomorrow, but I'm excited. ~John Demme
Mar 19 2006
John Demme wrote:I ran some tests earlier today, and I love it! This is great! Thanks, Walter ~John DemmeExcellent! I'm really glad this was fixed! -JJR
Mar 19 2006
"John Demme" <me teqdruid.com> wrote in message news:dvld5s$1e7c$1 digitaldaemon.com...I ran some tests earlier today, and I love it! This is great! Thanks, WalterYou're welcome! I'm glad it's working. I thought it would be much harder to implement than it turned out to be.
Mar 19 2006
Walter Bright wrote:"John Demme" <me teqdruid.com> wrote in message news:dvld5s$1e7c$1 digitaldaemon.com...That's the mark of a good design ;) AntI ran some tests earlier today, and I love it! This is great! Thanks, WalterYou're welcome! I'm glad it's working. I thought it would be much harder to implement than it turned out to be.
Mar 19 2006
In article <dvlhg4$1koq$1 digitaldaemon.com>, Ant says...Walter Bright wrote:I agree - I recall seeing Walter making similiar remarks about implementing other features of D. Pretty cool."John Demme" <me teqdruid.com> wrote in message news:dvld5s$1e7c$1 digitaldaemon.com...That's the mark of a good design ;) AntI ran some tests earlier today, and I love it! This is great! Thanks, WalterYou're welcome! I'm glad it's working. I thought it would be much harder to implement than it turned out to be.
Mar 20 2006
Walter Bright wrote:I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlThank you. :)
Mar 19 2006
Nice work! (there's a small typo in the changelog: converstion) L.
Mar 19 2006
In article <dvj3fi$2jb0$1 digitaldaemon.com>, Walter Bright says...I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlPardon my ignorance, but what is (was) "the interface covariant problem"? Nick
Mar 20 2006
"Nick" <Nick_member pathlink.com> wrote in message news:dvmuuu$kjm$1 digitaldaemon.com...In article <dvj3fi$2jb0$1 digitaldaemon.com>, Walter Bright says...See the "interfaces :-(" thread over in digitalmars.D.dtlI wanted to get the interface covariant problem fixed for the library guys.Pardon my ignorance, but what is (was) "the interface covariant problem"?
Mar 20 2006
Walter Bright wrote:I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.html:)
Mar 21 2006
Walter Bright wrote:I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlOut of curiosity - how did you implement it? xs0
Mar 21 2006
"xs0" <xs0 xs0.com> wrote in message news:dvpgtm$ua2$1 digitaldaemon.com...Walter Bright wrote:The type returned by a virtual function is the type of its introducing function. After the function returns, it is cast to the derived return type.I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlOut of curiosity - how did you implement it?
Mar 21 2006
Walter Bright wrote:"xs0" <xs0 xs0.com> wrote in message news:dvpgtm$ua2$1 digitaldaemon.com...Hmm, so casting between FooInterface[] and FooClass[] still doesn't work, right? Are you sure that's better than spending a few cycles per method call? Furthermore, some common operations would actually be faster: - returning interfaces from functions :) - calling methods defined in Object - testing for equality BTW, the spec should say something on that matter, I think you should either make the array casting work or declare it illegal, as an invalid reference is utterly useless. At least one will get a nice error message instead of a big "WTF?!?" expression on his face, when he tries to call a method :) xs0Walter Bright wrote:The type returned by a virtual function is the type of its introducing function. After the function returns, it is cast to the derived return type.I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlOut of curiosity - how did you implement it?
Mar 21 2006
"xs0" <xs0 xs0.com> wrote in message news:dvq249$1ljb$1 digitaldaemon.com...Hmm, so casting between FooInterface[] and FooClass[] still doesn't work, right?That's right.Are you sure that's better than spending a few cycles per method call? Furthermore, some common operations would actually be faster: - returning interfaces from functions :) - calling methods defined in Object - testing for equality BTW, the spec should say something on that matter, I think you should either make the array casting work or declare it illegal, as an invalid reference is utterly useless. At least one will get a nice error message instead of a big "WTF?!?" expression on his face, when he tries to call a method :) xs0
Mar 21 2006
Walter Bright wrote:"xs0" <xs0 xs0.com> wrote in message news:dvq249$1ljb$1 digitaldaemon.com...And the rest of the post...?Hmm, so casting between FooInterface[] and FooClass[] still doesn't work, right?That's right.Are you sure that's better than spending a few cycles per method call? Furthermore, some common operations would actually be faster: - returning interfaces from functions :) - calling methods defined in Object - testing for equality BTW, the spec should say something on that matter, I think you should either make the array casting work or declare it illegal, as an invalid reference is utterly useless. At least one will get a nice error message instead of a big "WTF?!?" expression on his face, when he tries to call a method :) xs0
Mar 22 2006
"Kyle Furlong" <kylefurlong gmail.com> wrote in message news:dvr1n7$2sub$1 digitaldaemon.com...And the rest of the post...?Casting is a blunt instrument, you need to be careful with it. Disabling casting is a bad idea, because one needs a way around the type system.
Mar 22 2006
Walter Bright wrote:"Kyle Furlong" <kylefurlong gmail.com> wrote in message news:dvr1n7$2sub$1 digitaldaemon.com...So how come you can't cast a double to int delegate(int)? :P You can still go via void*, if you want to. But normally, it should be forbidden, because the result is both useless and dangerous (in the sense that attempting to use it will call some random method). I can't believe you don't agree this should be an error; currently it's not even a run-time error!?! Note that this will be a major minus for anyone coming from Java. There, it's completely natural that a FooClass[] can be treated as FooInterface[] and Anything[] can be treated as Object[] (the cast is even implicit). Furthermore, it's quite common to refactor code by making type Whatever an interface when it was a class before, and while you claim you want D to be practical, you obviously expect a coder to manually go through the entire code base each time he does that, just in case the type was used in a way that won't work anymore. xs0And the rest of the post...?Casting is a blunt instrument, you need to be careful with it. Disabling casting is a bad idea, because one needs a way around the type system.
Mar 22 2006
xs0 wrote:Walter Bright wrote:Yes, if this is not "fixed", we certainly need some Java->D tutorials regarding this issue. IMHO all ugly explicit casts should be done behind the scenes."Kyle Furlong" <kylefurlong gmail.com> wrote in message news:dvr1n7$2sub$1 digitaldaemon.com...So how come you can't cast a double to int delegate(int)? :P You can still go via void*, if you want to. But normally, it should be forbidden, because the result is both useless and dangerous (in the sense that attempting to use it will call some random method). I can't believe you don't agree this should be an error; currently it's not even a run-time error!?! Note that this will be a major minus for anyone coming from Java. There, it's completely natural that a FooClass[] can be treated as FooInterface[] and Anything[] can be treated as Object[] (the cast is even implicit).And the rest of the post...?Casting is a blunt instrument, you need to be careful with it. Disabling casting is a bad idea, because one needs a way around the type system.Furthermore, it's quite common to refactor code by making type Whatever an interface when it was a class before,Exactly.and while you claim you want D to be practical, you obviously expect a coder to manually go through the entire code base each time he does that, just in case the type was used in a way that won't work anymore.No! It shouldn't go that way. Usually these casts aren't necessary in CPU-intensive loops (at least they can be avoided). An extra overhead from implicit reference handling wouldn't cause much performance loss.
Mar 22 2006
xs0 wrote:Walter Bright wrote:The same way in which covariantly overriding a class method is implemented, surely. Strikes me as trivial ... unless "the" interface covariant problem is something different from the two interface covariant problems I've seen.... Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlOut of curiosity - how did you implement it?
Mar 22 2006
Stewart Gordon wrote:xs0 wrote:Well, there's quite a difference between classes and interfaces in handling covariance: - all class references to the same object have the same value (i.e. they point to the same address), regardless of their type - interface references to the same object, on the other hand, don't point to the same address So, for class covariance to work, nothing needs to be done, except of course checking at compile time whether the two types are indeed covariant. With interfaces, some juggling needs to be done to produce the correct reference. Of course, all that interface ref juggling produces problems, and I've been trying to convince Walter to change the way interfaces are implemented, but no success so far :) xs0Walter Bright wrote:The same way in which covariantly overriding a class method is implemented, surely. Strikes me as trivial ... unless "the" interface covariant problem is something different from the two interface covariant problems I've seen....I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlOut of curiosity - how did you implement it?
Mar 22 2006
xs0 wrote:Stewart Gordon wrote:<snip> I think we are talking at cross purposes. The two interface covariance problems I know of are: (a) a method defined in an interface cannot be implemented with a covariant return type - this is a trivial matter of compile-time type checking and is now fixed (b) strange things happen when you try to override a method with an interface return type to have a class return type - this bug is still there http://d.puremagic.com/bugzilla/show_bug.cgi?id=65 What is this other issue you're talking about, which is also fixed? Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.xs0 wrote:Well, there's quite a difference between classes and interfaces in handling covariance: - all class references to the same object have the same value (i.e. they point to the same address), regardless of their type - interface references to the same object, on the other hand, don't point to the same addressWalter Bright wrote:The same way in which covariantly overriding a class method is implemented, surely. Strikes me as trivial ... unless "the" interface covariant problem is something different from the two interface covariant problems I've seen....I wanted to get the interface covariant problem fixed for the library guys. http://www.digitalmars.com/d/changelog.htmlOut of curiosity - how did you implement it?
Mar 22 2006
Stewart Gordon wrote:xs0 wrote:Could be..Stewart Gordon wrote:I think we are talking at cross purposes.xs0 wrote:Well, there's quite a difference between classes and interfaces in handling covariance: - all class references to the same object have the same value (i.e. they point to the same address), regardless of their type - interface references to the same object, on the other hand, don't point to the same addressWalter Bright wrote:The same way in which covariantly overriding a class method is implemented, surely. Strikes me as trivialI wanted to get the interface covariant problem fixed for the library guys.Out of curiosity - how did you implement it?What is this other issue you're talking about, which is also fixed?I was just trying to say covariance is not done the same way with interfaces as with classes, and is not quite as trivial :) xs0
Mar 22 2006
xs0 wrote:Stewart Gordon wrote:<snip>Yes, but UIMS it _is_ trivial for the bug that I've discovered is fixed. If you take this case (issue (a) in my last post) ---------- class Qwert {} interface Yuiop { Qwert asdfg(); } class Hjkl : Yuiop { Hjkl asdfg() { return new Hjkl; } } ---------- then since Qwert and Hjkl are both classes, and as you sayWhat is this other issue you're talking about, which is also fixed?I was just trying to say covariance is not done the same way with interfaces as with classes, and is not quite as trivial :)no runtime conversion is needed. The problem was purely that, when the compiler checked whether an interface is fully implemented, it would check for an exact match instead of a covariant match. OTOH Walter also said in another branch: "The type returned by a virtual function is the type of its introducing function. After the function returns, it is cast to the derived return type." This doesn't matter to issue (a), but it's what I had thought up before as a way of dealing with issue (b). However, issue (b) isn't fixed, so I'm wondering what it's about. Is there a subset of cases of issue (b) that is fixed now? I'd like to see an example. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.- all class references to the same object have the same value (i.e. they point to the same address), regardless of their type
Mar 23 2006