logo slogan

The Wicked Witch is now a blogger.

(Tin hats on folks!)


Are you rusting?


The Mozilla Foundation has become the latest outfit trying to provide a language that extends C without creating the disadvantages of C's successors, C++, Java and C#. The language, called RUST, has an eclectic approach to language design, citing many earlier languages as influences. Mozilla has supported the development of RUST as a language for its future client/server products.


RUST's developers cite Erlang as one of their sources of ideas. If RUST is intended for developing client-server applications, adopting Erlang itself might have been a better course, especially given Erlang's cleaner language design and impressive track record at Ericsson. TWW guesses that Mozilla wanted a new language that looked like C so that programmers would be less likely to shy away from learning it. Plus ça change, alors.


RUST's technical reference and user documents can be found at https://www.rust-lang.org/ They are easy to read but TWW thinks the material needs further work. The designers of RUST seem to have been sensible by providing powerful features that make it (allegedly) easy for the compiler to diagnose potential errors. Difficulty of static analysis is the bane of C's successor languages. (Which is why TWW doesn't go anywhere them near them unless under dire duress. )

 

RUST has a C-like syntactic flavour, with opening and closing curly braces instead of begin end. The sizes of the arithmetic types are defined in the language reference manual, a clear improvement over C. Also data objects are by default not mutable, i.e. they are effectively const unless explicitly declared mut. This and a set of quite tight rules regarding pointers seems intended to help the compiler detect various forms of aliasing so that warning messages can be generated. From the reference manual, TWW thinks that RUST's developers might be planning heavy-duty static analysis tooling – but this remains to be seen.

 

The character set is Unicode, overcoming one of C's major limitations. The type system includes constructs known as traits that permit some degree of inheritance without actually requiring full object-orented features. RUST does, however, stop short of offering full type abstraction. The nearest thing in RUST to a class is the module construct. Unusually for what is essentially an imperative language, lambda abstractions are available.


RUST avoids C's preprocessing, allowing it to separate macro expansion from external code inclusion. This is a step in the right direction but it is not yet clear to TWW that the use mechanism can be made fully independent of the host environment. Unhelpfully for bare-metal embedded systems developers, RUST carries over C's order-of-evaluation rules and requires a run-time system, albeit a “small” one.


It's too soon to see what impact RUST will have in the world of C-derived languages.TWW will highlight RUST in future postings, asking whether it could ever displace C as the main language for high-integrity embedded systems development. For now, watch this space.

 

The Wicked Witch

December 2015