Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 21, 2004 DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Here's an example where calling a method on an interface breaks using DMD 0.77. interface I { void M (); } interface J : I { void N (); } class A : I { void M () { } } class B : A, J { void N () { } } void main () { I f = new B (); f.M (); // Access violation. } This code is valid; the function call should work. Also, interface methods are not being treated like methods, as they should be. For example: interface I { void M (); void N (); } class A : I { // Doesn't work; it requires a body. abstract void M (); // Doesn't work; it's not considered part of the inheritance. override void N () { } } These should both work. Finally, this causes an access violation inside of the cast. It should work. interface A { void ma (); } interface B { void mb (); } class C : A, B { void ma () { } void mb () { } } void main () { A x = new C (); assert (cast (B) x); } I should explain what my situation is, but I don't feel like going into it right now. |
January 21, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Welcome back, Burton. Nice to hear from you. Hope you're here to stay. :) |
January 21, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Welcome Back. What are your plans with dig and the other cool software on your website? -Anderson |
January 22, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | "Burton Radons" <loth@users.sourceforge.net> wrote in message news:buku5a$21sm$1@digitaldaemon.com... > Here's an example where calling a method on an interface breaks using DMD 0.77. Thanks, I'll check it out. And welcome back! We've missed you here. |
March 08, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Burton Radons wrote:
> Here's an example where calling a method on an interface breaks using DMD 0.77.
>
> interface I
> {
> void M ();
> }
>
> interface J : I
> {
> void N ();
> }
>
> class A : I
> {
> void M () { }
> }
>
> class B : A, J
> {
> void N () { }
> }
>
> void main ()
> {
> I f = new B ();
>
> f.M (); // Access violation.
> }
>
> This code is valid; the function call should work.
>
> Also, interface methods are not being treated like methods, as they
> should be. For example:
>
> interface I
> {
> void M ();
> void N ();
> }
>
> class A : I
> {
> // Doesn't work; it requires a body.
> abstract void M ();
>
> // Doesn't work; it's not considered part of the inheritance.
> override void N () { }
> }
>
> These should both work.
>
> Finally, this causes an access violation inside of the cast. It should work.
>
> interface A
> {
> void ma ();
> }
>
> interface B
> {
> void mb ();
> }
>
> class C : A, B
> {
> void ma () { }
> void mb () { }
> }
>
> void main ()
> {
> A x = new C ();
>
> assert (cast (B) x);
> }
>
> I should explain what my situation is, but I don't feel like going into it right now.
These bugs remain in 0.81; I can't do anything with dig - or anything with interface abstraction - until they're fixed.
|
March 09, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | I fixed a bit about your sample. import std.c.stdio; interface I { public void M (); } interface J : I { public void N (); } class A : I { public void M () {printf("Hello from A"); } } class B : A, J { public void N () { } } void main () { J f = new B (); f.M (); getch(); } It's work . BTW, I think that if you don't define "public" , initialy D will know it's protected-package methods . I don't know much about OO with interface but when I test your sample in Java , it don't work just like D . But if I treat method of interface is public then it work . In Java if not have accessor so it know method is package protected methods , and , sorry for my OO stupid , I don't know why it didn't work unless "public" . Please could you have advise the case which you use "protected method" in interface ??? "Burton Radons" <loth@users.sourceforge.net> wrote in message news:c2i4dg$lfs$1@digitaldaemon.com... > Burton Radons wrote: > > Here's an example where calling a method on an interface breaks using DMD 0.77. > > > > interface I > > { > > void M (); > > } > > > > interface J : I > > { > > void N (); > > } > > > > class A : I > > { > > void M () { } > > } > > > > class B : A, J > > { > > void N () { } > > } > > > > void main () > > { > > I f = new B (); > > > > f.M (); // Access violation. > > } > > > > This code is valid; the function call should work. > > > > Also, interface methods are not being treated like methods, as they should be. For example: > > > > interface I > > { > > void M (); > > void N (); > > } > > > > class A : I > > { > > // Doesn't work; it requires a body. > > abstract void M (); > > > > // Doesn't work; it's not considered part of the inheritance. > > override void N () { } > > } > > > > These should both work. > > > > Finally, this causes an access violation inside of the cast. It should work. > > > > interface A > > { > > void ma (); > > } > > > > interface B > > { > > void mb (); > > } > > > > class C : A, B > > { > > void ma () { } > > void mb () { } > > } > > > > void main () > > { > > A x = new C (); > > > > assert (cast (B) x); > > } > > > > I should explain what my situation is, but I don't feel like going into it right now. > > These bugs remain in 0.81; I can't do anything with dig - or anything with interface abstraction - until they're fixed. > |
March 09, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tu Nam | Tu Nam wrote: > I fixed a bit about your sample. > import std.c.stdio; > interface I > { > public void M (); > } > > interface J : I > { > public void N (); > } > > class A : I > { > public void M () {printf("Hello from A"); } > } > > class B : A, J > { > public void N () { } > } > > void main () > { > J f = new B (); > > f.M (); > getch(); > } > It's work . > BTW, I think that if you don't define "public" , initialy D will know it's > protected-package methods . I don't know much about OO with interface but Wrong, members are public by default (not protected). > when I test your sample in Java , it don't work just like D . But if I treat > method of interface is public then it work . In Java if not have accessor so > it know method is package protected methods , and , sorry for my OO stupid , > I don't know why it didn't work unless "public" . > Please could you have advise the case which you use "protected method" in > interface ??? > Well your code run fine, but is not the Burton Radons code..... you write: J f = new B (); but you must write following Burton's example: I f = new B (); that cause Access violation when f.M () is executed. Another thing, |
March 09, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Julio Jiménez | I'm terrible sorry , perhap I overdosed ;((( "Julio Jiménez" <jujibo@inicia.es> wrote in message news:c2kiiv$1t40$1@digitaldaemon.com... > Tu Nam wrote: > > I fixed a bit about your sample. > > import std.c.stdio; > > interface I > > { > > public void M (); > > } > > > > interface J : I > > { > > public void N (); > > } > > > > class A : I > > { > > public void M () {printf("Hello from A"); } > > } > > > > class B : A, J > > { > > public void N () { } > > } > > > > void main () > > { > > J f = new B (); > > > > f.M (); > > getch(); > > } > > It's work . > > BTW, I think that if you don't define "public" , initialy D will know it's > > protected-package methods . I don't know much about OO with interface but > > Wrong, members are public by default (not protected). > > > when I test your sample in Java , it don't work just like D . But if I treat > > method of interface is public then it work . In Java if not have accessor so > > it know method is package protected methods , and , sorry for my OO stupid , > > I don't know why it didn't work unless "public" . > > Please could you have advise the case which you use "protected method" in > > interface ??? > > > > Well your code run fine, but is not the Burton Radons code..... you write: > > J f = new B (); > > but you must write following Burton's example: > > I f = new B (); > > that cause Access violation when f.M () is executed. > > Another thing, > |
March 31, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | I, too, have run aground on each of these issues; they are still present in 0.82, and are giving me grief with Dsc. Access violations of any kind should ideally be fixed asap, but these interface-related ones seem to persist longer than one might hope for. Maybe we should petition Walter <g> "Burton Radons" <loth@users.sourceforge.net> wrote in message news:c2i4dg$lfs$1@digitaldaemon.com... > Burton Radons wrote: > > Here's an example where calling a method on an interface breaks using DMD 0.77. > > > > interface I > > { > > void M (); > > } > > > > interface J : I > > { > > void N (); > > } > > > > class A : I > > { > > void M () { } > > } > > > > class B : A, J > > { > > void N () { } > > } > > > > void main () > > { > > I f = new B (); > > > > f.M (); // Access violation. > > } > > > > This code is valid; the function call should work. > > > > Also, interface methods are not being treated like methods, as they should be. For example: > > > > interface I > > { > > void M (); > > void N (); > > } > > > > class A : I > > { > > // Doesn't work; it requires a body. > > abstract void M (); > > > > // Doesn't work; it's not considered part of the inheritance. > > override void N () { } > > } > > > > These should both work. > > > > Finally, this causes an access violation inside of the cast. It should work. > > > > interface A > > { > > void ma (); > > } > > > > interface B > > { > > void mb (); > > } > > > > class C : A, B > > { > > void ma () { } > > void mb () { } > > } > > > > void main () > > { > > A x = new C (); > > > > assert (cast (B) x); > > } > > > > I should explain what my situation is, but I don't feel like going into it right now. > > These bugs remain in 0.81; I can't do anything with dig - or anything with interface abstraction - until they're fixed. > |
May 25, 2004 Re: DMD 0.77 bug: interface broken. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | "Burton Radons" <loth@users.sourceforge.net> wrote in message news:buku5a$21sm$1@digitaldaemon.com... > Here's an example where calling a method on an interface breaks using DMD 0.77. > > interface I > { > void M (); > } > > interface J : I > { > void N (); > } > > class A : I > { > void M () { } > } > > class B : A, J > { > void N () { } > } > > void main () > { > I f = new B (); > > f.M (); // Access violation. > } > > This code is valid; the function call should work. Fixed in next update. > Also, interface methods are not being treated like methods, as they should be. For example: > > interface I > { > void M (); > void N (); > } > > class A : I > { > // Doesn't work; it requires a body. > abstract void M (); Already fixed. > // Doesn't work; it's not considered part of the inheritance. > override void N () { } This doesn't compile, and I don't think it should. > } > > These should both work. > > Finally, this causes an access violation inside of the cast. It should work. > > interface A > { > void ma (); > } > > interface B > { > void mb (); > } > > class C : A, B > { > void ma () { } > void mb () { } > } > > void main () > { > A x = new C (); > > assert (cast (B) x); > } This currently works. |
Copyright © 1999-2021 by the D Language Foundation