Alternative to Interfaces

1001Days onek1days at anon.anon
Fri Jan 18 00:08:00 UTC 2019


Hello,

Preface: I do apologize if this is too simplistic of a matter, 
and if I need to RTFM. I'm quite slow.

I want to use Structs instead of Classes, but I don't want to 
lose the abilities of Interfaces. So instead I used a combination 
of templates, constraints, the hasMember trait, and delegates to 
achieve a simple alternative. It works, but I have two questions 
regarding its efficacy: is it viable in the long run, and is it 
now possible to use delegates without the GC? The latter is of 
particular importance as I'm using Structs for compatibility.

With thanks,
1001Days


More information about the Digitalmars-d-learn mailing list