Re: Declaring interfaces with a constructor

2017-03-14 Thread evilrat via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 13:54:41 UTC, David Zhang wrote: Yeah, that's the idea. Though I just thought of a possibility using an isPublicInterface template. Is that what you meant by templates and duck typing? Not sure about what that template does, but the idea behind ranges is

Re: Declaring interfaces with a constructor

2017-03-14 Thread David Zhang via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 02:14:53 UTC, evilrat wrote: like this? -- [snip] - there is also way to do this using templates and duck typing, I think it will be more idiomatic way since ranges and stuff heavily use

Re: Declaring interfaces with a constructor

2017-03-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 March 2017 at 19:31:52 UTC, David Zhang wrote: Basically, I want to define a common interface for a group of platform-specific classes, except that they should ideally also share constructor parameters. What I want to do is then alias them to a common name, selecting the

Re: Declaring interfaces with a constructor

2017-03-13 Thread David Zhang via Digitalmars-d-learn
On Monday, 13 March 2017 at 17:52:09 UTC, XavierAP wrote: On Monday, 13 March 2017 at 02:15:21 UTC, David Zhang wrote: What it says on the tin. Is there a way to create interfaces with a constructor or must I use an abstract class. What do you want to do in your constructor? I can't think of

Re: Declaring interfaces with a constructor

2017-03-13 Thread XavierAP via Digitalmars-d-learn
On Monday, 13 March 2017 at 02:15:21 UTC, David Zhang wrote: What it says on the tin. Is there a way to create interfaces with a constructor or must I use an abstract class. What do you want to do in your constructor? I can't think of anything that wouldn't change some state, either of the

Declaring interfaces with a constructor

2017-03-12 Thread David Zhang via Digitalmars-d-learn
What it says on the tin. Is there a way to create interfaces with a constructor or must I use an abstract class. Additionally, is there a way to force the linker to link a function in a class without an implementation with another that does have an implementation? i.e. --- //module a;