digitalmars.D.learn - bug in package-attribute in interfaces
- Extrawurst (34/34) Jul 17 2007 is this possibly a bug in dmd ?
- Jarrett Billingsley (5/9) Jul 17 2007 Don't quote me on this but I think I heard that 'package' methods are od...
- Extrawurst (3/16) Jul 17 2007 removing package works as expected, but it was exactly the "package"
- Jarrett Billingsley (9/11) Jul 17 2007 'package' has never been given much attention, sadly. The thing is that...
- Bruno Medeiros (8/28) Jul 18 2007 It is said that interface methods should all be public, since doing
- Bruno Medeiros (7/36) Jul 18 2007 Hum, I forgot: that's how it *should* work, but D currently doesn't
is this possibly a bug in dmd ?
[CODE FILE "test/inter.d"]
module test.inter;
interface IFoo {
package void bar();
}
class Foo:IFoo {
package void bar() {
}
}
[CODE FILE "test/testMe.d"]
module test.testMe;
import test.inter;
class Test {
IFoo member;
this() {
member = new Foo();
}
void bla() {
member.bar();
}
}
[CODE FILE "main.d"]
module main;
import test.testMe;
void main(){
Test test = new Test();
test.bla();
}
Gives linker error:
test\testMe.obj(testMe)
Error 42: Symbol Undefined _D4test5inter4IFoo3barMFZv
why is this?
Jul 17 2007
"Extrawurst" <spam extrawurst.org> wrote in message news:f7i0b0$25d6$1 digitalmars.com...Gives linker error: test\testMe.obj(testMe) Error 42: Symbol Undefined _D4test5inter4IFoo3barMFZv why is this?Don't quote me on this but I think I heard that 'package' methods are oddly non-virtual. Try removing the 'package' attribute from the interface/class methods.
Jul 17 2007
removing package works as expected, but it was exactly the "package" attribute i need in this situation ;-( Jarrett Billingsley schrieb:"Extrawurst" <spam extrawurst.org> wrote in message news:f7i0b0$25d6$1 digitalmars.com...Gives linker error: test\testMe.obj(testMe) Error 42: Symbol Undefined _D4test5inter4IFoo3barMFZv why is this?Don't quote me on this but I think I heard that 'package' methods are oddly non-virtual. Try removing the 'package' attribute from the interface/class methods.
Jul 17 2007
"Extrawurst" <spam extrawurst.org> wrote in message news:f7jbaa$1ouh$1 digitalmars.com...removing package works as expected, but it was exactly the "package" attribute i need in this situation ;-('package' has never been given much attention, sadly. The thing is that 'package' is an entirely different animal from 'public', 'private', and 'protected', but D doesn't seem to treat it as such. 'package' controls visibility between modules; it shouldn't have any effect on whether a method is virtual or nonvirtual. (Yes, this has been discussed before, probably for at least two years, if not longer. Nothing has ever been addressed.)
Jul 17 2007
Extrawurst wrote:removing package works as expected, but it was exactly the "package" attribute i need in this situation ;-( Jarrett Billingsley schrieb:It is said that interface methods should all be public, since doing otherwise kinda goes against the purpose of an interface (which is to expose an inteface :P). Try making the interface itself package, instead of the interface's methods. -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D"Extrawurst" <spam extrawurst.org> wrote in message news:f7i0b0$25d6$1 digitalmars.com...Gives linker error: test\testMe.obj(testMe) Error 42: Symbol Undefined _D4test5inter4IFoo3barMFZv why is this?Don't quote me on this but I think I heard that 'package' methods are oddly non-virtual. Try removing the 'package' attribute from the interface/class methods.
Jul 18 2007
Bruno Medeiros wrote:Extrawurst wrote:Hum, I forgot: that's how it *should* work, but D currently doesn't honor protection attributes for types(classes, interfaces, etc.), only for variables and functions. -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#Dremoving package works as expected, but it was exactly the "package" attribute i need in this situation ;-( Jarrett Billingsley schrieb:It is said that interface methods should all be public, since doing otherwise kinda goes against the purpose of an interface (which is to expose an inteface :P). Try making the interface itself package, instead of the interface's methods."Extrawurst" <spam extrawurst.org> wrote in message news:f7i0b0$25d6$1 digitalmars.com...Gives linker error: test\testMe.obj(testMe) Error 42: Symbol Undefined _D4test5inter4IFoo3barMFZv why is this?Don't quote me on this but I think I heard that 'package' methods are oddly non-virtual. Try removing the 'package' attribute from the interface/class methods.
Jul 18 2007









"Jarrett Billingsley" <kb3ctd2 yahoo.com> 