5 ms·
For the sake of being fair for other programming languages, what are the languages with proper specification? C, C++, JavaScript, others?
by miohtama 4y ago
For the sake of being fair for other programming languages, what are the languages with proper specification? C, C++, JavaScript, others?
- randomdata 4y agoGo is staunch about its specification. To the point that the Go team maintains two independent compiler implementations to ensure that "features"/bugs in one implementation doesn't end up defining the standard and to ensure that a compiler can be implemented from the spec.
- tristan957 4y agoIs the other compiler you are referring to gcc-go?
- recov 4y agoThere's actually 3 now from google afaik - gc - gccgo - gollvm [0] [0] https://go.googlesource.com/gollvm/ https://go.googlesource.com/gollvm/
- munificent 4y agoDart has a complete specification. It tends to lag somewhat behind the most recent features (which are documented in separate language proposals), but we keep it as current as we can. Maintaining a language specification is a lot more work than people realize, and a job that few have the skills to do well.
- xchkr1337 4y agoIn my opinion the presence of undefined behavior in the C/C++ specification makes it no better than the "specification by implementation" approach
- spac 4y agowithout a specification you can never tell with certainty if there's a bug
- yencabulator 4y agoC/C++ "undefined behavior" means your program is wrong and not within the spec, not that different compiler implementations might differ. There is no scenario in which any code with UB is valid, regardless of what compiler implementation you use. That's very different. (And IMHO a horrible feature of the spec, but it's there for historical reasons.) C/C++ spec does have some "implementation defined behavior", which is where you can't rely on what will happen unless you know what compiler you're targeting. They are explicitly listed out as such, and not that common.
- Alifatisk 4y agoRuby?
- steveklabnik 4y agoIf you're referring to the ISO spec, it's effectively completely irrelevant. If you're talking about ruby/spec, a comprehensive test suite is really great, but is also not what most people think about when they think of a spec, though it also may count! You could even argue that such a thing is better than a traditional spec.
- Alifatisk 4y agoYes, I was thinking about the latter but was unsure if it counted. Yes, looking at the spec has been a helpful strategy for me to understand how something is supposed to work.
- G3rn0ti 4y agoRaku fka Perl 6.
- wtetzner 4y agoStandard ML, Scheme, Common Lisp, Java.
- duped 4y agoI guess you have to define "specification" because there's a spectrum. A full book describing the formal syntax, semantics, type system, and standard library/built ins (and macros, preprocessing, compiler flags, what have you) is fairly rare because of how big it needs to be. Partial specification like the grammar, the type system, etc are more common (particularly because they're so useful for writing one implementation, let alone multiple!).
- Uvix 4y agoC# has a spec, although it's a few versions out-of-date. https://github.com/dotnet/csharpstandard/blob/draft-v7/standard/README.md https://github.com/dotnet/csharpstandard/blob/draft-v7/stand...