It's a class! It's a struct! It's ... SuperStruct!

rcorre via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Oct 21 19:35:32 PDT 2015


On Wednesday, 21 October 2015 at 23:09:52 UTC, Timon Gehr wrote:
> "A call signature for a given member is 'compatible'
>  * if, for an instance of any one of `SubTypes`, that member 
> can be called with
>  * the provided set of arguments _and_ all such calls have a 
> common return type."
>
>
> Probably you could/should return your SuperStruct instead of 
> the/when there is no common return type.

Interesting idea! At first I thought you meant returning the 
original SuperStruct, but then I realized it could be a 
SuperStruct of the return types.

That could be really nice for functions that return different 
types of ranges, as your return type would just be 'something' 
that has 'front, top, empty, ect.'.

Come to think of it, SuperStruct actually sounds pretty similar 
to std.range.chooseAmong (which I just realized exists).


More information about the Digitalmars-d-announce mailing list