typeof and block statements

2010-08-12 Thread simendsjo
The spec doesn't mention anything about block statements in typeof declarations. //typeof({1}) a; // found } expecting ; //typeof({1}()) b; // same as a typeof(1) c; // int I'm asking because isInputRange from std.range the idom from the b test: template isInputRange(R

Re: typeof and block statements

2010-08-12 Thread Steven Schveighoffer
On Thu, 12 Aug 2010 09:13:54 -0400, simendsjo simen.end...@pandavre.com wrote: The spec doesn't mention anything about block statements in typeof declarations. //typeof({1}) a; // found } expecting ; //typeof({1}()) b; // same as a typeof(1) c; // int

Re: typeof and block statements

2010-08-12 Thread Mafi
Am 12.08.2010 15:13, schrieb simendsjo: The spec doesn't mention anything about block statements in typeof declarations. //typeof({1}) a; // found } expecting ; //typeof({1}()) b; // same as a typeof(1) c; // int I'm asking because isInputRange from std.range the idom from the b test

Re: typeof and block statements

2010-08-12 Thread Stanislav Blinov
12.08.2010 17:13, simendsjo wrote: The spec doesn't mention anything about block statements in typeof declarations. //typeof({1}) a; // found } expecting ; //typeof({1}()) b; // same as a typeof(1) c; // int I'm asking because isInputRange from std.range the idom from the b test

Re: typeof and block statements

2010-08-12 Thread simendsjo
On 12.08.2010 15:30, Steven Schveighoffer wrote: On Thu, 12 Aug 2010 09:13:54 -0400, simendsjo simen.end...@pandavre.com wrote: The spec doesn't mention anything about block statements in typeof declarations. //typeof({1}) a; // found } expecting ; //typeof({1}()) b; // same as a typeof(1) c

Re: typeof and block statements

2010-08-12 Thread simendsjo
about block statements in typeof declarations. //typeof({1}) a; // found } expecting ; //typeof({1}()) b; // same as a typeof(1) c; // int {...} is a function literal, a lambda function if you will. I thought parameterless delegates were written () {}.. Your lambda function contains a syntax

Re: typeof and block statements

2010-08-12 Thread Steven Schveighoffer
On Thu, 12 Aug 2010 10:29:41 -0400, simendsjo simen.end...@pandavre.com wrote: On 12.08.2010 16:19, Steven Schveighoffer wrote: On Thu, 12 Aug 2010 09:56:07 -0400, simendsjo simen.end...@pandavre.com wrote: Why doesn't this work then? typeof({return 1;}()) a; // found 'a' when expecting

Re: typeof and block statements

2010-08-12 Thread simendsjo
On 12.08.2010 16:39, Steven Schveighoffer wrote: (...) Tested with dmd 2.048 on win7. pragma(msg, module:~typeof({return 1;}()).stringof); void main() { pragma(msg, main:~typeof({return 1;}()).stringof); //typeof({return 1;}()) a; // found 'a' when expecting ';' following statement } prints