digitalmars.D - interfaces and static methods
- Miguel Ferreira Simões (14/14) Dec 23 2004 The following code does not compile, is it supposed?
- Thomas Kuehne (13/13) Dec 23 2004 -----BEGIN PGP SIGNED MESSAGE-----
- Charles (8/22) Dec 23 2004 I dont think its supposed to. If so I would imagine the body in the
- Miguel Ferreira Simões (7/7) Dec 23 2004 I think the problem is still there if i subsitute the interface for an
- Charles (15/24) Dec 23 2004 I see them as purley an abstraction , a contract saying 'you must implem...
- Sjoerd van Leent (15/30) Dec 24 2004 Yes both Java and .NET do, however, I think that is an ugly method. For
- Miguel Ferreira Simões (10/10) Dec 25 2004 I am not saying intefaces should have static methods: that question is
- Walter (7/16) Dec 27 2004 abstract
- Thomas Kuehne (5/22) Dec 27 2004 Couldn't this be done via the "type pointer"?
The following code does not compile, is it supposed? interface ITest { static void func(); } class Test : ITest { static void func() { } } int main(char[][] args) { ITest t = new Test; t.func(); } -- Miguel Ferreira Simoes
Dec 23 2004
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Added to DStress as http://svn.kuehne.cn/dstress/compile/interface_08.d http://svn.kuehne.cn/dstress/compile/interface_09.d http://svn.kuehne.cn/dstress/run/interface_10.d http://svn.kuehne.cn/dstress/run/interface_11.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFByzU13w+/yD4P9tIRAmGQAKCRqx5WxmoD8mNdRt4RU9KuVbTcWACeJIM7 WcpvplEMK8FGCMeR2j42+rc= =1hOt -----END PGP SIGNATURE-----
Dec 23 2004
I dont think its supposed to. If so I would imagine the body in the interface ( but I dont think interfaces should have static methods ). Also where can I your NN code again ? Perhaps you could set it up on dsource ? Thanks, Charlie "Miguel Ferreira Simões" <Kobold netcabo.pt> wrote in message news:cqe7j0$2fl3$1 digitaldaemon.com...The following code does not compile, is it supposed? interface ITest { static void func(); } class Test : ITest { static void func() { } } int main(char[][] args) { ITest t = new Test; t.func(); } -- Miguel Ferreira Simoes
Dec 23 2004
I think the problem is still there if i subsitute the interface for an abstract class. You said you are against static methods in interfaces. Why? Right now my homepage is down. But I will re-activate it a near future. If you want I can e-mail you a copy of my NN code (the project is temporarily halted until February, because I do not have time). Miguel Ferreira Simoes
Dec 23 2004
You said you are against static methods in interfaces. Why?I see them as purley an abstraction , a contract saying 'you must implement these' , as opposed to a structure or something that would contain code or variables. I usually do : interface IFoo {} class AbstractFoo : IFoo { static void bar() {} ; int inheritedVariable; } allow static methods in interfaces ?If you want I can e-mail you a copy of my NN codePlease :). greenelephant.charles gmail.com Also do you know a good online source about neural networks ( the examples Ive seen dont incorporate noise / cost / regularization ). Thanks, Charlie "Miguel Ferreira Simões" <Kobold netcabo.pt> wrote in message news:cqfjgb$12n5$1 digitaldaemon.com...I think the problem is still there if i subsitute the interface for an abstract class. You said you are against static methods in interfaces. Why? Right now my homepage is down. But I will re-activate it a near future. If you want I can e-mail you a copy of my NN code (the project is temporarily halted until February, because I do not have time). Miguel Ferreira Simoes
Dec 23 2004
Charles wrote:Yes both Java and .NET do, however, I think that is an ugly method. For D it isn't necessary due to the fact that it also supports pure procedural development (hibrid development). Therefor a D source file can declare methods right into the module body. Abstract classes are not meant to interface, but are mostly used for predefined functionality, which may or may not depend on extra methods needed by one or more already specified methods. Interfaces are not meant for abstraction in the manner of making code more reusable (as abstract classes do), but abstraction in the manner of making components more reusable. This also makes it possible for interfaces to develop components using a modulair approach (using Shared Libraries, COM, CORBA, etcetera) and therefor behave (more) dynamic. Regards, SjoerdYou said you are against static methods in interfaces. Why?I see them as purley an abstraction , a contract saying 'you must implement these' , as opposed to a structure or something that would contain code or variables. I usually do : interface IFoo {} class AbstractFoo : IFoo { static void bar() {} ; int inheritedVariable; } allow static methods in interfaces ?
Dec 24 2004
I am not saying intefaces should have static methods: that question is controversial. Nevertheless, in my humble opinion, abstract classes should support abstract static methods. It compiles. But gives me a link error when I try to use the static method: Error 42: Symbol Undefined _D6source8graphics5image11ImageLoader11ImageLoader10 extensionsFZAAa -- errorlevel 1 Miguel Ferreira Simoes
Dec 25 2004
"Miguel Ferreira Simões" <Kobold netcabo.pt> wrote in message news:cqji9h$26ro$1 digitaldaemon.com...I am not saying intefaces should have static methods: that question is controversial. Nevertheless, in my humble opinion, abstract classes should supportabstractstatic methods. It compiles. But gives me a link error when I try to use the staticmethod:Error 42: Symbol Undefined _D6source8graphics5image11ImageLoader11ImageLoader10 extensionsFZAAa -- errorlevel 1The trouble is it cannot know which function to call without a 'this' pointer, and once there is a 'this' pointer, it isn't a static method anymore!
Dec 27 2004
Walter schrieb in cqoj5a$sle$2 digitaldaemon.com."Miguel Ferreira Simões" <Kobold netcabo.pt> wrote in messageCouldn't this be done via the "type pointer"? 1) If there is a 'this' pointer, use the current lookup. 2) Without a 'this' pointer query the type information for static functions. Thomasnews:cqji9h$26ro$1 digitaldaemon.com... I am not saying intefaces should have static methods: that question is controversial. Nevertheless, in my humble opinion, abstract classes should support abstract static methods. It compiles. But gives me a link error when I try to use the static method: Error 42: Symbol Undefined _D6source8graphics5image11ImageLoader11ImageLoader10 extensionsFZAAa -- errorlevel 1The trouble is it cannot know which function to call without a 'this' pointer, and once there is a 'this' pointer, it isn't a static method anymore!
Dec 27 2004