std.boxer vs Any

Daniel Keep daniel.keep.lists at gmail.com
Tue Oct 9 22:10:41 PDT 2007



Bill Baxter wrote:
> Daniel Keep wrote:
>> And just to throw a little more wood on the fire:
>> http://www.prowiki.org/wiki4d/wiki.cgi?DanielKeep/Variant
>>
>> :P
>>
>>     -- Daniel
> 
> Maybe you could comment on what makes yours different/better than the
> alternatives, then.  Do we really need three different versions of this?
>  Are they suited for different purposes?
> 
> --bb

Well, the primary difference between mine and std.boxer is that mine
works in Tango out of the box.

The other reason I wrote it was because of something Pragma posted about
on the Tango forums about making a Box that was easier to use.  The
major improvement is the use of opAssign that allows you to directly
assign to a Variant.  I also like to think that Variant is easier to use
than std.boxer.

The whole "operator overloading" business was done mostly because I
wanted to see if it *could* be done.  :P

Really, I think there's only so much you can do with a variant type in
D, and Box and Variant each do about 90% of it (not the *same* 90%, mind
you; Variant doesn't do the "call a vararg function using a Box array"
trick.)  In the case of Box and Variant, the differences are mostly just
implementation and interface issues.

	-- Daniel



More information about the Digitalmars-d mailing list