www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to use template Object in interface?

reply zoujiaqing <zoujiaqing gmail.com> writes:
hunt-cache current version use template implemention adapter 
changes.

I want use Interface to define Adapter, this master code unable 
to comple.

How to do it? D programming language design flaws?

```bash
git clone https://github.com/huntlabs/hunt-cache
cd hunt-cache/example
dub run -v

...

source/app.d(29,19): Error: no property name for type 
Nullable!(User)

```
Jun 25 2019
next sibling parent zoujiaqing <zoujiaqing gmail.com> writes:
On Tuesday, 25 June 2019 at 12:11:47 UTC, zoujiaqing wrote:
 hunt-cache current version use template implemention adapter 
 changes.

 I want use Interface to define Adapter, this master code unable 
 to comple.

 How to do it? D programming language design flaws?

 ```bash
 git clone https://github.com/huntlabs/hunt-cache
 cd hunt-cache/example
 dub run -v

 ...

 source/app.d(29,19): Error: no property name for type 
 Nullable!(User)

 ```
Interface code: https://github.com/huntlabs/hunt-cache/blob/master/source/hunt/cache/adapter/Adapter.d ```D module hunt.cache.adapter.Adapter; import hunt.cache.Nullable; interface Adapter { Nullable!V get(V) (string key); Nullable!V[string] get(V) (string[] keys); void set(V) (string key, V value, uint expired); void set(V) (V[string] maps, uint expired); bool setIfAbsent(V) (string key, V value); bool hasKey(string key); bool remove(string key); void remove(string[] keys); void clear(); } ```
Jun 25 2019
prev sibling parent zoujiaqing <zoujiaqing gmail.com> writes:
On Tuesday, 25 June 2019 at 12:11:47 UTC, zoujiaqing wrote:
 hunt-cache current version use template implemention adapter 
 changes.

 I want use Interface to define Adapter, this master code unable 
 to comple.

 How to do it? D programming language design flaws?

 ```bash
 git clone https://github.com/huntlabs/hunt-cache
 cd hunt-cache/example
 dub run -v

 ...

 source/app.d(29,19): Error: no property name for type 
 Nullable!(User)

 ```
Error in this commit: https://github.com/huntlabs/hunt-cache/commit/1f4ca85b47a7e62b41907152f8c8904e69a09975
Jun 26 2019