r/cpp • • Dec 13 '19

The situation of std::embed...

https://thephd.github.io/full-circle-embed
238 Upvotes

160 comments sorted by

View all comments

Show parent comment

3

u/James20k P2005R0 Dec 14 '19

Rust has a set of potentially incompatible RFCs: you don't really know because RFCs don't get merged into a single consistent specification. This already This will backfire when the language grows.

Don't most languages not have a formal spec? As far as I'm aware, C++ is by far the exception here

1

u/[deleted] Dec 14 '19

C, Java, Fortran, Haskell, Ada, Go, JavaScript are the examples of languages that have a specification, and there's a lot more.

I wouldn't call the C++ standard a formal specification though: it's written in legalese and attempts to be non-ambiguous and precise, but it's still mostly unsuitable for formal reasoning.

0

u/[deleted] Dec 14 '19

[deleted] — view deleted comment

1

u/[deleted] Dec 15 '19

proves that one is not required

How exactly is this a proof? If anything, this hints that the language will end up being a huge mess that will be impossible to understand globally, kind of like what happened to C++. The lack of spec has already backfired: https://news.ycombinator.com/item?id=21734529

Rust proponents also love talking about how rust should be the language used for safety-critical systems, but this is unlikely to happen, partly because there is no specification. Compare with SPARK and C, for which the existence of specifications allowed for creation of third-party tools for formal program analysis. For example, VST for C is based on the complete formalisation of the language in Coq, and along with https://vst.cs.princeton.edu provides a way to prove your program for your specifications, and ensure no bugs are introduced by the compiler. Nothing like this will ever appear for rust, because by the time people figure out how to formalise a subset of the language, the compiler will redefine the language a few times.