Re: the traits trap

2014-11-21 Thread Steven Schveighoffer via Digitalmars-d
On 11/21/14 2:25 AM, Sergei Nosov wrote: On Friday, 21 November 2014 at 04:08:52 UTC, Steven Schveighoffer wrote: Can anyone figure out a good solution to this problem? I like template constraints, but they are just too black-boxy. Would we have to signify that some enum is actually a trait and

the traits trap

2014-11-20 Thread Steven Schveighoffer via Digitalmars-d
OK, so I'm writing some traits that I'd like my objects to satisfy. And I'm having the worst time debugging them. Most of the traits in D look like this: enum isSomeType(T) = __traits(compiles, (T t){ // some statements using t // some asserts // some static asserts }); All good.

Re: the traits trap

2014-11-20 Thread Meta via Digitalmars-d
On Friday, 21 November 2014 at 04:08:52 UTC, Steven Schveighoffer wrote: OK, so I'm writing some traits that I'd like my objects to satisfy. And I'm having the worst time debugging them. Most of the traits in D look like this: enum isSomeType(T) = __traits(compiles, (T t){ // some

Re: the traits trap

2014-11-20 Thread Sergei Nosov via Digitalmars-d
On Friday, 21 November 2014 at 04:08:52 UTC, Steven Schveighoffer wrote: Can anyone figure out a good solution to this problem? I like template constraints, but they are just too black-boxy. Would we have to signify that some enum is actually a trait and so the compiler would know to spit out

Re: the traits trap

2014-11-20 Thread Paolo Invernizzi via Digitalmars-d
On Friday, 21 November 2014 at 04:08:52 UTC, Steven Schveighoffer wrote: This is one area that D's templates are very user-unfriendly. -Steve +1, Well said! --- Paolo