Thread overview
Block Statement scope
Jan 27, 2006
Marcio Faustino
Jan 27, 2006
Roberto Mariottini
Jan 27, 2006
Marcio Faustino
January 27, 2006
Hi all,

The examples func2() and func3() from
http://www.digitalmars.com/d/statement.html compile without any warning, where
it should be an error.

--
Marcio Faustino


January 27, 2006
In article <drcmmp$kuh$1@digitaldaemon.com>, Marcio Faustino says...
>
>Hi all,
>
>The examples func2() and func3() from
>http://www.digitalmars.com/d/statement.html compile without any warning, where
>it should be an error.

IIRC, from a long discussion in the D newsgroup, it was later decided that func3 should be legal code, while func2 and func4 should issue an error.

Ciao
---
http://www.mariottini.net/roberto/


January 27, 2006
In article <drcpts$o9s$1@digitaldaemon.com>, Roberto Mariottini says...
>
>In article <drcmmp$kuh$1@digitaldaemon.com>, Marcio Faustino says...
>>
>>Hi all,
>>
>>The examples func2() and func3() from
>>http://www.digitalmars.com/d/statement.html compile without any warning, where
>>it should be an error.
>
>IIRC, from a long discussion in the D newsgroup, it was later decided that func3 should be legal code, while func2 and func4 should issue an error.
>
>Ciao
>---
>http://www.mariottini.net/roberto/
>
>

Sorry I didn't know that, but still func2() should cause a compile error.

--
Marcio Faustino


February 16, 2006
Marcio Faustino wrote:
> In article <drcpts$o9s$1@digitaldaemon.com>, Roberto Mariottini says...
>> In article <drcmmp$kuh$1@digitaldaemon.com>, Marcio Faustino says...
>>> Hi all,
>>>
>>> The examples func2() and func3() from
>>> http://www.digitalmars.com/d/statement.html compile without any warning, where
>>> it should be an error.
>> IIRC, from a long discussion in the D newsgroup, it was later decided that func3 should be legal code, while func2 and func4 should issue an error.
>>
>> Ciao
>> ---
>> http://www.mariottini.net/roberto/
>>
>>
> 
> Sorry I didn't know that, but still func2() should cause a compile error.

Confirmed with dmd 0.147 on linux. func2() should produce an error, but
it doesn't.

There's also an error in the docs - func3() should be legal, because previous x is introduced in it's own scope inside the first block.

-- 
Jari-Matti