Thread overview
Variant/Variant/Box wrappers?
Jan 05, 2008
Christopher Wright
Jan 06, 2008
Dan
Jan 06, 2008
Christopher Wright
January 05, 2008
Hey --

I've got stuff that I want to work in dmd1/phobos, dmd2/phobos, and dmd1/tango. I really want to use boxing, since it'd make a lot of stuff easier, but there are three disparate structs to support: tango Variant, phobos Variant, and phobos Box.

Does anyone have wrappers for these? If so, do they handle structs of arbitrary sizes? (Phobos Variant doesn't, which makes it mostly useless without a wrapper anyway.)
January 06, 2008
Christopher Wright Wrote:

> Hey --
> 
> I've got stuff that I want to work in dmd1/phobos, dmd2/phobos, and dmd1/tango. I really want to use boxing, since it'd make a lot of stuff easier, but there are three disparate structs to support: tango Variant, phobos Variant, and phobos Box.
> 
> Does anyone have wrappers for these? If so, do they handle structs of arbitrary sizes? (Phobos Variant doesn't, which makes it mostly useless without a wrapper anyway.)

The way I did things was I rolled my own.  In all honesty though, if you like the way one works, just use the actual source for it in your project.

e:/dmd/src/phobos/std/boxer.d http://dsource.org/projects/walnut/browser/branches/1.9/source/value.d

Something like that.

Regards,
Dan
January 06, 2008
Dan wrote:
> Christopher Wright Wrote:
> 
>> Hey --
>>
>> I've got stuff that I want to work in dmd1/phobos, dmd2/phobos, and dmd1/tango. I really want to use boxing, since it'd make a lot of stuff easier, but there are three disparate structs to support: tango Variant, phobos Variant, and phobos Box.
>>
>> Does anyone have wrappers for these? If so, do they handle structs of arbitrary sizes? (Phobos Variant doesn't, which makes it mostly useless without a wrapper anyway.)
> 
> The way I did things was I rolled my own.  In all honesty though, if you like the way one works, just use the actual source for it in your project.
> 
> e:/dmd/src/phobos/std/boxer.d
> http://dsource.org/projects/walnut/browser/branches/1.9/source/value.d
> 
> Something like that.  
> 
> Regards,
> Dan

Thanks, though I can't see how yours supports structs.

I think I don't want to maintain any sort of custom box type; I've solved the problem with early casting of the stuff that's supposed to return variable-typed values.