logoalt Hacker News

ameliaquining • today at 7:49 AM • 3 replies • view on HN

Do you also think the committee should ship a compiler? If not, what's the difference?


Replies

imtringued • today at 12:00 PM

The standard library would just be C++ code that a compiler turns into machine code.

I remember a language where the core language types, including primitives and a bunch of keywords, were actually defined in the standard library and the compiler just special cased support for the types in the standard library for optimization purposes.

Your loaded question feels very silly from that perspective.

tancop • today at 8:13 AM

Compilers are complex, platform specific and the architectures behind them can be wildly different. Maintaining a reference compiler would be a lot of work for no real benefit.

The standard library on the other hand is a library. It's almost always implemented as plain C++ without much platform specific code. ISO could take an existing free licensed implementation and declare it as the standard. Of course anyone is free to make their own competing one, it just has to always match the official library's behavior.

Writing a spec instead of code is just creating duplicate work and compatibility issues any time the spec is unclear.

forrestthewoods • today at 8:50 AM

The difference is that I can trivially write a std::deque container that runs under any compiler that implements the C++ spec.

Why on earth would I want a different implementation of std::deque on each platform I use because the compiler team needed to provide one? It’s madness!