Why D functions paramter can not implicit infer type of Variant?

Paul Backus snarwin at gmail.com
Wed Jan 13 19:38:55 UTC 2021


On Wednesday, 13 January 2021 at 18:09:08 UTC, sighoya wrote:
> A more natural conclusion would be to infer c to the most 
> common supertype as other inferences would unnecessarily 
> exclude future assignments to c.  But the most common supertype 
> doesn't seem to exist, and I'm unsure if this type can be 
> modeled at all in D?

That's what Variant is--a struct that models the universal 
supertype (sometimes called "Top" or "Any").


More information about the Digitalmars-d-learn mailing list