enum and tuples
Jonathan M Davis
jmdavisProg at gmx.com
Sat Aug 10 23:59:27 PDT 2013
On Sunday, August 11, 2013 07:24:52 captaindet wrote:
> > I'm pretty sure that this is just a bad error message.
> >
> >> void main(){
> >> writeln("ok: ", ok, " ok[0]: ", ok[0]);
> >> // ok: Tuple!(string, string, string)("one", "two", "three")
> >
> >> ok[0]:
> > one
> >
> >> writeln("er: ", er, " er[0]: ", er[0]);
> >> // er: onetwothree er[0]: one
> >> }
> >
> > What I expect is happening is that TypeTuples don't convert to
> > string, so the
> > pragma fails,
>
> hmm, but it is a TypeTuple of strings and aren't they supposed to
> automatically expand? and pragma(msg, ...) takes various
> arguments, e.g.
>
> pragma(msg, "this", "and", "that");
>
> so is it just a bad error message or a "bug" in pragma(msg, ...)?
> (..,i know, pragmas are difficult to blame for anything as they
> are not part of the language proper. but in lieu of a compile
> time print this is all we got for debugging our meta stuff.)
>
> then there is the thing of assigning value type TypeTuples to
> variables/enums. is this allowed or not? see my observations
> regarding enums which are for 2.063.2. according to anonymous in
> the git head for 2.064 the enum example for string value
> TypeTuples now fails...i don't think any of this behavior is
> documented anywhere. what i think is missing is a clearly defined
> boundary/set of rules for what we can do with the internal
> "tuples" (aka TypeTuples) and how, and what not.
I don't know why you're seeing the problems that you're seeing
pragma(msg, "this", "and", "that");
seems to work, so I'd have expected the TypeTuple to work. I expect that it's
a compiler bug. And yes, TypeTuples should definitely be assignable to enums
(though where you can use such an enum depends on where you can use a
TypeTuple - the enum's value is essentially copy-pasted wherever the enum is
used). I think that things are far more confusing for you due to compiler
bugs.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list