Go = Google Oberon ?

Dr Maurer of http://www.murus.eu/ announced he is rewriting parts of his Murus and jMurus software for the new Google language 'Go'. Now, ths means something. Dr Maurer is a real Modula-2 diehard. So if he changes over to 'Go' it must be something special.

So I paid some attention to 'Go' as well. When you look at some smaller sources you see a resemblance to Modula-2 and Oberon. Many 'Go' keywords are borrowed from Oberon and Modula. Also the syntax of 'Go' is based on Oberon. Even parts of the underlying thoughts are strongly influenced by the school of Niklaus Wirth. Still, when you go deeper into the 'Go' language, you soon find out that 'Go' is just another C compiler. Here http://golang.org/doc/go_tutorial.html you find the following piece of text:

This document is a tutorial introduction to the basics of the Go programming language, intended for programmers familiar with C or C++. It is not a comprehensive guide to the language; at the moment the document closest to that is the language specification. After you've read this tutorial, you should look at Effective Go, which digs deeper into how the language is used and talks about the style and idioms of programming in Go.

Note the piece in red. I hoped that fluency in Modula-2 and Oberon would also do when trying to read the 'Go' documents. But that was too much asked. The tutorial is only comprehensible when you are a C, C++ or Java programmer. It teaches them to use some kind of type casting. But 'Go' is too chaotic to be used as such by true followers of Professor Wirth. I guess Dr Maurer was spoiled a bit by his Java attempts and now embraces 'Go' because 'Go' is C-ish while still leaning somewhat against Modula-2.

An example

The Go tutorial starts with an example:

package main

import (
    "os"
    "flag"  // command line option parser
)
	
var omitNewline = flag.Bool("n", false, "don't print final newline")
	
const (
	Space = " "
	Newline = "\n"
)
		
func main() {
	flag.Parse()   // Scans the arg list and sets up flags
	var s string = ""
	for i := 0; i < flag.NArg(); i++ {
		if i > 0 {
			s += Space
		}
		s += flag.Arg(i)
	}
	if !*omitNewline {
		s += Newline
	}
	os.Stdout.WriteString(s)
}
   
Similarities with Oberon, for this small example: The rest is C or C-ish. Even the documentation is C-ish. Don't try to understand the tutorials when you are not fluent in C, C++ or Java. Even the EBNF definition of 'Go' is like C++. Much too complex and hence impossible to see through it. The 'Go' EBNF definition is the first EBNF I encountered that is harder to master than the language itself. Well done, Ken Thompson et al....

This quote is a nice one:

amd64 (a.k.a. x86-64); 6g,6l,6c,6a

The most mature implementation. The compiler has an effective optimizer (registerizer) and generates good code (although gccgo can do noticeably better sometimes).


It generates good code... Of course I tried to compile the Hello World example:
package main

import "fmt"

func main() {
    fmt.Println("Hello, world")
}
   
and it compiled to a lean executable of no more than 1 Megabyte. After stripping, only 750 Kb remained. Not bad for some good code. A comparable Mocka executable is something like 30 KB. And obc makes a very small executable file, of less than 4 kilobyte. So far for 'Go' I guess.

Page created on 4 August 2011 and