Hello.
Consider this code
void main()
{
l:
{
int v;
}
v = 5; // ok, v is defined
}
As I understand from D's grammar this behaviour is not a bug as
LabeledStatement:
Identifier : NoScopeStatement
and NoScopeStatement in turn takes BlockStatement without creating new
scope.
It
My gut feeling is that the if statement's behavior is wrong and the
while statement's is correct, but it could go either way.
No need for a rationale for what can be adequately explained as a
compiler bug (this is a downside of dmd - it trains you to think like
this) It is curious, though, as
poking around a little more and I really don't know what's going on.
fun piece of trivia though: while loops get rewritten to for loops, so
for(;;) l1 {
int v;
}
v = 4;
exhibits the same behavior as the while loop.
do loops seem to do the same thing as the if statement
On 11/15/2010 10:34
Ellery Newcomer:
> No need for a rationale for what can be adequately explained as a
> compiler bug (this is a downside of dmd - it trains you to think like
> this)
Or: Any sufficiently incomprehensible behaviour is indistinguishable from a DMD
compiler bug :-)
Bye,
bearophile
On 15/11/2010 16:45, Ellery Newcomer wrote:
poking around a little more and I really don't know what's going on.
fun piece of trivia though: while loops get rewritten to for loops, so
for(;;) l1 {
int v;
}
v = 4;
exhibits the same behavior as the while loop.
do loops seem to do the same thing
On Mon, 15 Nov 2010 19:34:46 +0300, Ellery Newcomer
wrote:
My gut feeling is that the if statement's behavior is wrong and the
while statement's is correct, but it could go either way.
I agree, I think case with 'when' works as specs say.
No need for a rationale for what can be adequately
On 16/11/2010 15:11, Nick Voronin wrote:
There is still correct but unexpected behaviour. I found this on bugtracker
http://d.puremagic.com/issues/show_bug.cgi?id=199
The rationale was "I don't want to change this because it could break
existing code,
and there doesn't seem to be a compelling re