4 ms·
Plenty of languages have a specification. C++, Java, C# all do. Some languages do not, such as Python and Rust. The ISO C++ committee even uses quite strong l
by Kranar 3y ago
Plenty of languages have a specification. C++, Java, C# all do.
Some languages do not, such as Python and Rust.
The ISO C++ committee even uses quite strong language about the C++ standard and makes it a point to differentiate between the C++ specification and C++ references:
>The standard is not intended to teach how to use C++. Rather, it is an international treaty – a formal, legal, and sometimes mind-numbingly detailed technical document intended primarily for people writing C++ compilers and standard library implementations.
- pdonis 3y agoDoes every C++ implementation do exactly what is in the C++ language specification, no more, no less? Same question for Java and C#. If the answer to all of these questions is "no", as I believe it is, on what grounds do you claim that these languages have a specification, while Python and Rust do not?
- Kranar 3y agoYes the C++ and Java implementations do exactly what is in the language specification. The C++ specification explicitly allows languages to do more, but it can not do less. I believe Java has a similar clause but I'm not sure. The grounds that I claim is that you can read them, here they are: https://docs.oracle.com/javase/specs/ https://docs.oracle.com/javase/specs/ https://isocpp.org/files/papers/N4860.pdf https://isocpp.org/files/papers/N4860.pdf Note what the actual C++ standard states, and I quote: >This document specifies requirements for implementations of the C++ programming language. The first such requirement is that they implement the language, so this document also defines C++. Other requirements and relaxations of the first requirement appear at various places within this document
- pdonis 3y ago> the C++ and Java implementations do exactly what is in the language specification The number of Google hits I get when I search on "C++ implementations that do not meet the language specification" does not seem to support this claim. > Note what the actual C++ standard states But your position with respect to Python is that it doesn't matter what the "standard" states because the actual definition of the language is in its reference implementation. Why are you now shifting your ground?
- Kranar 3y ago>The number of Google hits I get when I search on That is an incredibly weak and ill-informed method for vetting technical matters. >Why are you now shifting your ground? Python doesn't have a standard.
- pdonis 3y ago> That is an incredibly weak and ill-informed method for vetting technical matters. So is your claim that, because a "standard" says something and claims it's a "specification", that is sufficient to guarantee that every implementation does exactly what the "standard" or "specification" says. > Python doesn't have a standard Again, you're quibbling. It has a language reference, which I linked to, and which is what is used to determine what implementations count as Python implementations. At this point I don't think we have enough common ground for a useful discussion.
- Kranar 3y ago>So is your claim that, because a "standard" says something and claims it's a "specification", that is sufficient to guarantee that every implementation does exactly what the "standard" or "specification" says. It's the other way around, a standard specifies the requirements of a conforming implementation, and then an implementation can claim conformance with respect to that standard. With C++, many well-known implementations do claim conformance to the standard such as MSVC, GCC and Clang. With Python no one makes such a claim, not even the CPython reference implementation, because there is no standard to conform to. On the contrary what you do find are implementations that try to be compatible with CPython reference implementation specifically, such as PyPy and Pyston but no one claims to conform to the Python reference manual. The reference document simply describes how some Python implementations happen to work, but it does not prescribe how a Python implementation is required to work in order to be in compliance. If tomorrow CPython decides to add a new feature to the language, then the reference will be updated to include this change because the reference is a reflection of the implementation. If tomorrow the C++ specification changes, then it's GCC or any compiler that claims conformance that will update to include that change because with C++ it's the implementation that is a reflection of the specification. That's the key difference between a descriptive document and a prescriptive document. This may seem like a quibble as you put it, but quibbles can lead to multimillion dollar lawsuits as Microsoft learned in the 90s when they claimed to have an implementation of the Java specification and then were sued by Sun Microsystems because Microsoft's implementation did not in fact conform to the Java standard. Microsoft ended up paying 20 million dollars over this so called "quibble": https://en.wikipedia.org/wiki/Microsoft_Java_Virtual_Machine#Sun_vs._Microsoft https://en.wikipedia.org/wiki/Microsoft_Java_Virtual_Machine...
- samus 3y agoThe C and C++ specifications are rather infamous about being incomplete, i.e., containing features that might lead to undefined behavior. On the other hand, Java is quite comprehensive. It is one of the earliest instances of languages specifying a memory model.