For the new std.variant

Steve Teale steve.teale at britseyeview.com
Mon Oct 31 23:34:03 PDT 2011


On Mon, 31 Oct 2011 21:03:39 +0100, Trass3r wrote:

>> I literally meant it is not supposed to exist. There was a suggestion
>> to even axe it from 2.056 I believe.
> 
> At least they prepared to actually deprecate it.
> 
> 
>> A library solution is intended to be created which will allow for the
>> type to act as either a parent or child to the type.
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=5467

OK, my use case is that in the database interface modules, as far as 
possible I would like to infer an SQL type from a D type. There are often 
SQL types for TIME, DATE, DATETIME, and TIMESTAMP, but the latter two 
will usually correspond to D structs with the same members.

I can define two identical structs with the same set of protocol parsing 
and packing methods, but with different names, but to me this seems 
clunky, error-prone, and not a very good advert for the language.

There's was also a temptation to create typedefs of char[] like 
tinyString, mediumString and longString. I have not gone there - just as 
well.

Forgetting typedef, which I should assume does not exist, what is the 
elegant approach to this?

Steve


More information about the Digitalmars-d mailing list