Recently, I've watched some videos about C# async bugs and got into discussions with friends.
Is it correct to say that a programming language has a bug ? or can you only say that a compiler has a bug ?
what is the difference between both ?
Recently, I've watched some videos about C# async bugs and got into discussions with friends.
Is it correct to say that a programming language has a bug ? or can you only say that a compiler has a bug ?
what is the difference between both ?
The language has a design flaw if it's not designed well for whatever reason (e.g. the ability to call static methods via an expression of the declaring type in Java, IMO).
The language has a bug (IMO) if the specification is contradictory or doesn't express what the author intended it to express. (I believe there are some bugs in the C# language specification around type inference, for example.)
The compiler has a bug if it fails to implement the specification correctly.
EDIT: I've found an example of a spec bug which is rather simpler than type inference ones...
In the C# 4 spec, section 7.3.1 states: "Except for the assignment operators, all binary operators are left-associative".
Section 7.13 states: "The null coalescing operator is right-associative"
As the null coalescing operator is a non-assignment binary operator, this is a contradiction and thus (IMO) a bug. (It was also noted in this Stack Overflow question.)
The null coalescing operator also provides an example of a compiler bug which I discovered while answering that question...
It could be either. Languages and compilers can both have bugs. A language bug is one that will appear no matter the compiler being used, where as a compiler bug will only appear within a specific compiler.
Actually a bug is considered as a difference in spec and actual implementation.
So yes, in that sense both can have a bug.
A programming language IS the specification of the language. What is possible, is that there is an ambiguity or irregulary in the specification of the language and in that sense you can say it has a bug.
However, possibly there is a difference between the specification of C# and the compiler. In that case, the bug is inside the compiler.