Re: template instance does not match template declaration

2022-02-25 Thread Paul Backus via Digitalmars-d-learn
On Friday, 25 February 2022 at 23:34:59 UTC, kdevel wrote: What about this: ```d module model; // model.d import std.file : read; // this line provokes the error private int read (string filename) // now it's private { import std.file; auto data = std.file.read (filename); return 0; }

Re: template instance does not match template declaration

2022-02-25 Thread kdevel via Digitalmars-d-learn
On Friday, 25 February 2022 at 23:17:14 UTC, Paul Backus wrote: [...] Currently, selective imports are implemented using `alias`es under the hood, which means that the compiler sees your `model` module as having *two* overloads of `read`: ```d alias read = std.file.read; // from selective impo

Re: template instance does not match template declaration

2022-02-25 Thread Paul Backus via Digitalmars-d-learn
On Friday, 25 February 2022 at 23:05:00 UTC, kdevel wrote: It seems the template parameter f becomes not aliased to model.read in the presence of the selective import. Bug or feature? I'd call this a bug. Currently, selective imports are implemented using `alias`es under the hood, which mea

Re: template instance does not match template declaration

2022-02-25 Thread kdevel via Digitalmars-d-learn
```main.d module main; // main.d import std.traits; import model; void main () { enum Q = Parameters!read; } ``` Will not compile with selective import commented out. Hence main.d must read (alias instead of enum): ```main.d module main; // main.d import std.traits; import model; void ma

Re: template instance does not match template declaration

2017-01-15 Thread Fabrice Marie via Digitalmars-d-learn
On Sunday, 8 January 2017 at 05:45:52 UTC, Meta wrote: On Sunday, 8 January 2017 at 03:27:26 UTC, Fabrice Marie wrote: void main() { Cache!(BasicObject, string, lookupBasicObject); } In addition to what Nicholas Wilson said, what you're doing here is the equivalent of writin

Re: template instance does not match template declaration

2017-01-07 Thread Meta via Digitalmars-d-learn
On Sunday, 8 January 2017 at 03:27:26 UTC, Fabrice Marie wrote: void main() { Cache!(BasicObject, string, lookupBasicObject); } In addition to what Nicholas Wilson said, what you're doing here is the equivalent of writing `int;`. It doesn't make any sense as Cache!(...) is a

Re: template instance does not match template declaration

2017-01-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 8 January 2017 at 03:27:26 UTC, Fabrice Marie wrote: Hi, On my first attempt to create a templated class, I'm hitting an issue that I can't seem to resolve. I've dustmite'd the code down to: class Cache(O, K, F) { } void main() { class BasicObject { }