August 11, 2013
On 08/09/2013 10:41 AM, H. S. Teoh wrote:

> 1) There's the built-in tuple, which is a compiler concept, and
> basically means any sequential collections of "things" (for lack of a
> better word). For example, you can have a sequence of types, like (int,
> string, float), or a sequence of values, like (1, "a", 3.0), or even a
> mixture of both, like (1, int, "a", float, string, 3.14). These
> sequences are called "tuples".

Thank you and Jonathan. The above is exactly what helped me understand them finally. Your explanation matches my understanding exactly.

> we abstract away the list of function/template arguments and
> say those arguments are tuples, so then if something else
> produces or returns a tuple, then we can plug that in where a
> parameter list would be expected.

That was the missing piece of the puzzle for me.

And a very important point to make is that "the list of function/template arguments" are not TypeTuples. TypeTuple is just a tool that makes them available to the code.

Thank you,
Ali

August 11, 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
August 12, 2013
On 2013-08-11 01:59, Jonathan M Davis wrote:
> 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.

thanks jonathan. yours and ali's explanations have been very helpful to understand what is going on. i filed a bug report:

http://d.puremagic.com/issues/show_bug.cgi?id=10803

/det
1 2
Next ›   Last »