Re: Why typeof(template) is void?

2016-07-20 Thread mogu via Digitalmars-d-learn
On Wednesday, 20 July 2016 at 08:01:01 UTC, Lodovico Giaretta wrote: Note that void is a type, while S is not. So you can do: assert(is(void)) // is(type) returns true assert(!is(S)) // is(template) returns false; Thanks very much. I should have noticed this before. T.T

Re: Why typeof(template) is void?

2016-07-20 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 20 July 2016 at 05:54:41 UTC, mogu wrote: On Wednesday, 20 July 2016 at 01:50:37 UTC, Adam D. Ruppe wrote: On Wednesday, 20 July 2016 at 01:14:05 UTC, mogu wrote: Why S's type isn't something like `S: (T) -> S`? Because S isn't a type... think of a template as being like a

Re: Why typeof(template) is void?

2016-07-19 Thread mogu via Digitalmars-d-learn
On Wednesday, 20 July 2016 at 01:50:37 UTC, Adam D. Ruppe wrote: On Wednesday, 20 July 2016 at 01:14:05 UTC, mogu wrote: Why S's type isn't something like `S: (T) -> S`? Because S isn't a type... think of a template as being like a function that returns a type. int foo(int) { return 0; }

Re: Why typeof(template) is void?

2016-07-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 20 July 2016 at 01:14:05 UTC, mogu wrote: Why S's type isn't something like `S: (T) -> S`? Because S isn't a type... think of a template as being like a function that returns a type. int foo(int) { return 0; } There, you wouldn't expect typeof(foo) to be int, no, typeof(foo)