Re: UDA inheritance

2020-09-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 10 September 2020 at 13:06:41 UTC, Joseph Rushton Wakeling wrote: `hasUDA!(T, AnotherUDA)` ...do you have to use hasUDA? The language works with class UDAs, but hasUDA doesn't support it. If you write your own test function though you can: ``import std.traits; class BaseUDA {

Re: UDA inheritance

2020-09-10 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Thursday, 10 September 2020 at 13:14:47 UTC, drug wrote: Just a thought - couldn't you use classes for this? Get an UDA and check if it is a descendant of the specific class. Yes, I did wonder about that, but it doesn't allow all the inference that I'm looking for. For example: class

Re: UDA inheritance

2020-09-10 Thread drug via Digitalmars-d-learn
On 9/10/20 4:06 PM, Joseph Rushton Wakeling wrote: Hello folks, Is there any way to define UDAs such that they automatically inherit other UDA definitions? For example, suppose I define:     enum BaseUDA { A, B } Is there a way to define `AnotherUDA` such that if `hasUDA!(T, AnotherUDA)`

UDA inheritance

2020-09-10 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hello folks, Is there any way to define UDAs such that they automatically inherit other UDA definitions? For example, suppose I define: enum BaseUDA { A, B } Is there a way to define `AnotherUDA` such that if `hasUDA!(T, AnotherUDA)` then it is a given that `hasUDA!(T, BaseUDA)` will a