Typesafety versus Worse is Better - was Re: Fwd: is there any word processing software for the pdp11?
abuse at cabal.org.uk
Thu Dec 4 17:01:01 CST 2014
On Tue, Dec 02, 2014 at 08:09:42PM -0500, Toby Thain wrote:
> You can give it up any time. There are dozens of far better languages that
> have cropped up in the 40 years since C was invented for a particular
> environment (that doesn't resemble anything much we do today).
When it comes to what calls "freestanding" environments, options are
*extremely* limited, with C being the lingua franca. C++ is a reasonable
alternative as it can be used to file off some of the rougher edges if used
diligently, but brings problems of its own. Rust has some excellent ideas and
can likely move into this space, but it's not quite ready for prime time.
These are all still essentially procedural stack languages with manual memory
management though, as it's easy to reason about and provides cheap interop with
existing legacy C code.
But when we look at languages claimed to be "better" than C, they tend to all
fall by the wayside when it comes to freestanding systems due to requiring some
sort of operating system or other heavyweight execution environment, or don't
have the necessary primitives to get down and dirty with I/O devices.
A curious outlier is OCaml, a strongly-typed functional language that compiles
down to machine code and has had its language runtime ported to the bare metal.
It is used to devastating effect in MirageOS to create hardened single-purpose
sandboxed services that essentially run as independent kernels under a
virtualisation system. It's a trivial leap from that to running on bare metal,
and is certainly one to watch.
Are there any other (sane, supported) languages suitable for bare metal
programming that I ought to be aware of? Right now, C++ seems least-worst.
More information about the cctalk