[phobos] phobos commit, revision 1737

Shin Fujishiro rsinfu at gmail.com
Thu Jul 8 09:01:14 PDT 2010


Michel Fortin <michel.fortin at michelf.com> wrote:
> Le 2010-07-08 à 8:13, Andrei Alexandrescu a écrit :
> 
> > This is solid work! There's an opportunity here - it overlaps a LOT
> > with std.variant.Algebraic.
> 
> 
> Indeed. It's great. But why is the protection level set to 'package'?
> Isn't it meant to be used outside of Phobos? 

I needed it to implement native codeset support in stdio.  I just went
conservative for adding a public stuff that people might not use...


> One thing I've missed about Algebraic is the ability to switch on the
> type, somewhat like this:
> 
> 	Algebraic!(A, B, C) x;
> 	switch (x.type) {
> 		case x.typecode!A:
> 		case x.typecode!B:
> 		case x.typecode!C:
> 			...
> 	}
> 
> Seems like this would be easy by switching on Any's _duckID, but this
> facility isn't exposed (it's all private).

It's nice.  I'll add it!

switch (x.Algebraic.type) {
    case x.Algebraic.typeCode!A:
    case x.Algebraic.typeCode!B:
   ...
    default:
}


Shin


More information about the phobos mailing list