Monday, April 1, 2013

Thinking about Go documentation - Language Specification through the years ... Algol68 then, then C89 & Go now. (From: Google Groups/golang-nuts, with links to original A68 & C89 specs&books as PDFs)

ALGOL 68 was the first (and possibly one of the last) major language for which a full formal definition was made before it was implemented.
C.H.A. Koster Algol68 Report co-editor, [7]
Sadly Koster was killed in a motorcycle accident last week. c.f. http://www.ru.nl/icis/news/memoriam-kees-koster

1960s was a time for Informaticians to blaze a path and the construction of the Algol68 Report was a very early example of collaborations that has left echos in how collaborations have been done ever since.  Aside from being the first as above, it was early IT days so the actual report may well have been the first in several other areas.  It was certainly pioneering.

For example:
  • "Translations of the standard were made for Russian, German, French and Bulgarian, and then later Japanese and Chinese.  The standard was also made available in Braille."
    • The report "invented" its own vocabulary as was mentioned above.  
      • My favourite is GOMMA, for a ";" meaning "Go on comma", i.e. sequentially (vs in parallel or collaterally)
    • Arguably this vocabulary aided in the documents translation, moreover served as a technical blue print for actual implementation in other countries on other disparate computer systems (6-bit, 7-bit, 8-bit chars, 16-bit, 24-bit, 36-bit CPUs etc.)
    • (Maybe) As a result there are at least 20 independently constructed Algo68 compilers, plus a few interesting dialects such as S3 & Mary.
  • IMHO the report was targeted at compiler implementers not end users. 
    • e.g. Algol68's description is not just a 4 page BNF description as it includes lots of language semantic rules, hence it is not just purely about syntax.  
    • {Iconically here the Algol68 Report breaks "Wadler's Law": http://www.haskell.org/haskellwiki/Wadlers_Law about semantics vs syntax.}
    • Moreover the alternative could have been be to "code" these semantics in "English", hope they survive linguistic translations, or implement them in a 3GL like C then wait 10+ years for a the formal "English" version to be drafted as a actual formal standard.
  • The "Data Security" requirement allowed detecting semantic errors at compile time.
    • Compile time detection is better then run time cure (such as type error exception handling while code is in production)
    • Most of these "Data Security" semantics are specifically detailed in the actual "Algol68 Report" and were a language requirement.
Regarding documentation, here are some links:
Some people prefer to learn a language by reading source code: Don't get me wrong, the Algol68 Report is hard to read, especially to non-compiler writers.
  • Compare with the first C standard
  • The Go Programming Language Specification, Version of September 4, 2012
    • http://golang.org/ref/spec 110 pages of A4 as at March 2013.
    • Clear and easy to read.
    • Some of "English" semantics
      • Fortunately(?) only one implementation of Go will ever need exist
    • Good syntax description, but not much in the way of "Formal Semantics",
Confession: I have not learned Go yet... I'm itching to give it a go as I like many of the ideas incorporated.

All the best and enjoy
NevilleDNZ

No comments:

Post a Comment