Does D have object wrappers for primitives?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 29 13:46:29 PDT 2016


On 07/29/2016 01:40 PM, Cauterite wrote:
 > On Friday, 29 July 2016 at 20:26:47 UTC, Ali Çehreli wrote:
 >>
 >> I was going to suggest Algebraic because it allows arrays of mixed
 >> primitive types (wrapped in Algebraic):
 >>
 >>   https://dlang.org/phobos/std_variant.html#.Algebraic
 >>
 >> Ali
 >
 > It could work, but keep in mind Algebraic is a structure, not an object.

Also, I've later noticed that your Box was a class, so it would allow 
"arrays of mixed primitive types" as well.

Yes, Algebraic is not a struct but Java not having structs doesn't mean 
that the original code really needed classes either. :)

Ali



More information about the Digitalmars-d-learn mailing list