5 ms·
What are good examples of languages with specifications and at least two implementations that fully implement the spec?
by rcthompson 12y ago
What are good examples of languages with specifications and at least two implementations that fully implement the spec?
- CountSessine 12y agoGiven how complicated any specification for a non-trivial language is, I wonder if there are any. But I think this is beside the point. Not having a specification for a language pushes every language feature discussion down onto application and library developers 'in situ'. When a developer or library maintainer stumbles onto unexpected interpreter or compiler behavior in a language without a specification, it means that in the short term there's no guidance about how they should deal with it. Do I hack this for Visual C++ in a way that can be removed eventually or do I really have to assume going forward that variadic templates aren't going to be available?
- Joeri 12y agoC99 and C++11 have several compliant implementations, as does ECMAScript 5 (javascript). The benefit of a spec is not so much that all implementations are necessarily completely compliant, it's that you know what the behavior is supposed to be so you can implement to the spec and work around any differences in implementation. Plus, you can report bugs without them being closed as "by design".
- NateDad 12y agoGo has gc and gccgo. They made two implementations to keep the spec honest and not just "whatever the compiler does".
- chaoky 12y agoCommon Lisp, for sure
- rcthompson 12y agoYes, the various Lisps were the first possible examples I came up with (I think Scheme probably qualifies as well).
- catwell 12y agoIn Lua the user manual is the reference, so if the language does something different, it is considered a bug. If something is not described in the manual then it is an implementation detail (unspecified) and code that relies on it is broken. This led to several alternative implementations, among which at least one (LuaJIT) implements completely a version of the language (Lua 5.1).