What are the unused but useful feature you know in D?

rikki cattermole rikki at cattermole.co.nz
Sat Nov 4 13:27:29 UTC 2017


On 04/11/2017 2:14 PM, jmh530 wrote:
> On Saturday, 4 November 2017 at 12:20:37 UTC, rikki cattermole wrote:
>>
>> Like signatures which I'm working on!
>>
>> https://github.com/rikkimax/DIPs/blob/master/DIPs/DIP1xxx-RC.md
> 
> The first example kind of reminds me of what I was trying to do with 
> isSubTypeOf [1]. If you know that any function you can call on T can 
> also be called on U, then it has the same effect. That being said, I'm 
> not sure I really understand what you mean in the whole "Why not extend 
> interfaces" part.
> 
> 
> [1] https://github.com/dlang/phobos/pull/5700

Okay so:

A signature when it is initiated is aware of the implementation it is 
referencing. Allowing it to change how it behaves for compatibility reasons.

An interface is designed so that a class/interface must know of the 
interface to inherit from.

While signatures can and probably will inherit from others, this is not 
how it is used unlike with interfaces. Because this is a massive change 
in how we view them and their usage, extending interfaces is not 
appropriate. Luckily an already existing concept exists in the 
literature which does solve most of the goals and that is signatures 
from the ML family.

I will make a mental note to rewrite that section.


More information about the Digitalmars-d mailing list