enum and tuples

captaindet 2krnk at gmx.net
Sat Aug 10 22:24:52 PDT 2013


> 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.

/det


More information about the Digitalmars-d-learn mailing list