Is this a bug? +goto
ShadoLight
ettienne.gilbert at gmail.com
Fri Nov 9 16:42:19 UTC 2018
On Thursday, 8 November 2018 at 09:34:34 UTC, Michelle Long wrote:
>>> What I am talking about is about an obvious error...
OK, so here are your code slightly modified:
void main(){
int i;
W:
if(i==0)
goto Q;
int x;
Q:
i++;
if(i==1)
goto W;
writeln("a");
}
This code does not even skip the 'int x;' declaration and
initialization - it happens the 2nd time after the goto to W -
but still errors with exactly the same error i.e. 'goto skips
declaration of variable x'. so this is _clearly_ a bug in the
compiler (right?), even more so than your original case, since
the declaration + initialization are not in fact skipped here.
The reason for this behavior is what Jonathan and others have
tried to explain to you numerous times i.e. that the compiler
does not do flow analysis, and hence cannot detect that the above
is in fact working code.
You seem to be stuck on your premise that the compiler should be
able to detect your "trivially obvious case", but would you also
expect the compiler to detect the above case? You seem unwilling
to accept that it is a reasonable trade-off that the compiler
does not detect your "trivially obvious case", since the general
case can be arbitrarily complex - and D currently simply does not
do flow analysis. Maybe in the future it will do some form of
flow analysis (let's hope!), but currently it doesn't.
This isn't some 'conspiracy' or 'mindless' defense of the status
quo like you seem to claim:
>>> What you will find with some of these guys is they start with
>>> the assumption that everything D does is correct then they
>>> try to disprove anything that goes against it by coming up
>>> with reasons that explain why D does it the way it does. It
>>> is circular reasoning and invalid. Each step >>> they come up
>>> with some new explanation when you pick holes in their
>>> previous >>> ones.
If the above was really the case there wouldn't be over 4000 bugs
open in D at the moment [1], since they would be (according to
you) be rationalized as 'features', not 'bugs', right?
But above all ... I really think that you need to calm down a
notch or 2, you are seeing way too many conspiracies here. Stuff
like this...
>>> >> Don't let their psychobabble fool you. They are wrong and
>>> >> you were right from the start.
[snip]
>>> Is it logical that the compiler **should** error out in the
>>> first case and no in the second?
>>>
>>> That is what the discussion is ALL about.
[snip]
>>> THAT IS FACT! It doesn't matter if the examples work above. I
>>> have simplified what I have done and in my code I simply add
>>> brackets and it works! That is what people should be thinking
>>> about...
[snip]
> ... You can assume that I know how scopes work.
[snip]
> You shouldn't assume everyone can't comprehend such
> trivialities.
>
[snip]
> What happens when you do that you just create noise that makes
> it more difficult to have a proper discussion that gets at the
> whole point of the conversation.
>
> You seem to default to assuming that the person you are talking
> to has no clue about the problem at hand.
You really seem just a tad too certain of your facts and that
everyone else are just being obstructionists and incapable of
seeing your point. In fact you seem to be the one to block out
any 'other' factors raised by others (such as flow analysis), and
just keep seeing the issue in this simplistic "this is my view
and (I quote) 'what the discussion is ALL about'... ".
Are you really so convinced that only 'you' are seeing the forest
for the trees..?
I notice you started off the same way in your 'Dustmite + Visual
D' thread in the IDE category, chastising Valdimir who 'dared' to
contradict you:
>> As the error message says, the problem occurs because another
>> file is accessing it.
>>
> No, have you not learned in your life time that just because
> something or someeone says something doesn't make it true?
And then, in your typical self-assured way, corrected Vladimir
for his 'foolish idea' that the issue is unlikely to be the
junction:
> Let me enlighten you a little: The reason why this is most
> likely a junction is:
[snip]
Wow, to be so certain of yourself must be really nice... but...
maybe a bit foolish, since in the end it turned out ... Vladimir
was correct. But I guess the words "I was wrong" are not really
in your vocabulary, is it?
Maybe you need to take a long calm look at yourself in the
mirror... no-one here is out to "get you", in fact no-one here
thinks that the "D-way" is perfect! In fact, most of the
old-timers here are probably, more than most, aware of the warts
in D. Stick around on these forums for a few years and you will
see epic debates between the core developers on why feature 'X'
is broken, and what should be done to fix it!
But most of all... virtually every person that responded on this
thread tried to help you, or at least debate with you on the
why's and the how's... but you seem to take disagreements as
personal attacks. They are not. They are simply differences of
opinion.
Just mellow down a notch of 2. Please.
[1] https://dlang.org/bugstats.html
More information about the Digitalmars-d-learn
mailing list