Re: enum and tuples

2013-08-11 Thread captaindet
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 valu

Re: enum and tuples

2013-08-11 Thread Jonathan M Davis
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: ", e

Re: enum and tuples

2013-08-10 Thread Ali Çehreli
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,

Re: enum and tuples

2013-08-10 Thread captaindet
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 Type

Re: enum and tuples

2013-08-10 Thread Dejan Lekic
On Friday, 9 August 2013 at 21:24:30 UTC, Ali Çehreli wrote: On 08/09/2013 12:41 PM, captaindet wrote: > On 2013-08-09 11:36, Ali Çehreli wrote: >> as I am in the process of revising and translating a Tuples chapter. > as a matter of fact, i am checking your website regularly, eagerly > awaitin

Re: enum and tuples

2013-08-09 Thread Ali Çehreli
On 08/09/2013 12:41 PM, captaindet wrote: > On 2013-08-09 11:36, Ali Çehreli wrote: >> as I am in the process of revising and translating a Tuples chapter. > as a matter of fact, i am checking your website regularly, eagerly > awaiting the translations of the tuples chapter. and the __traits and

Re: enum and tuples

2013-08-09 Thread anonymous
On Friday, 9 August 2013 at 06:16:20 UTC, captaindet wrote: a) if we are not allowed to put typetuples in enums, why is it not an error? [...] enum er = TypeTuple!("one", "two", "three"); FWIW, it's an error in the current git head dmd: "Error: cannot cast "one" to (string, string, string) a

Re: enum and tuples

2013-08-09 Thread captaindet
On 2013-08-09 11:36, Ali Çehreli wrote: as I am in the process of revising and translating a Tuples chapter. thanks for the reply, Ali. as a matter of fact, i am checking your website regularly, eagerly awaiting the translations of the tuples chapter. and the __traits and the template chapter

Re: enum and tuples

2013-08-09 Thread Jonathan M Davis
On Friday, August 09, 2013 01:16:12 captaindet wrote: > module demo; > import std.stdio, std.typetuple, std.typecons; > > enum ok = tuple("one", "two", "three"); > pragma(msg, ok, ", ", ok[0]); > // Tuple("one", "two", "three"), one > enum er = TypeTuple!("one", "two", "three"); > // pragma(msg, e

Re: enum and tuples

2013-08-09 Thread Jonathan M Davis
On Friday, August 09, 2013 10:41:05 H. S. Teoh wrote: > On Fri, Aug 09, 2013 at 09:36:16AM -0700, Ali Çehreli wrote: > > On 08/08/2013 11:16 PM, captaindet wrote:> hi, > > > > > i am still struggling getting to grips with tuples, especially > > > typetuples. > > > > Yes, especially TypeTuples. :)

Re: enum and tuples

2013-08-09 Thread H. S. Teoh
On Fri, Aug 09, 2013 at 09:36:16AM -0700, Ali Çehreli wrote: > On 08/08/2013 11:16 PM, captaindet wrote:> hi, > > > i am still struggling getting to grips with tuples, especially > > typetuples. > > Yes, especially TypeTuples. :) > > > typetuples seem to live in a shadow world > > My feelings!

Re: enum and tuples

2013-08-09 Thread Ali Çehreli
On 08/08/2013 11:16 PM, captaindet wrote:> hi, > i am still struggling getting to grips with tuples, especially > typetuples. Yes, especially TypeTuples. :) > typetuples seem to live in a shadow world My feelings! :) Coincidentally, I am struggling with the same question at the moment as I a

enum and tuples

2013-08-08 Thread captaindet
hi, i am still struggling getting to grips with tuples, especially typetuples. i got into this when trying module introspection and the surprise discovery that __traits(allMembers, .) seems to return a typetuple of strings. (the tuple article on dlang and philippe's template tutorial do help a