- Error codes are a poor substitutions for Exceptions
- Have to code around lack of generics, e.g. by abusing their typed map if possible
- Defer less desirable and intuitive than C# using
- array bracket notation prefixing the variable
- No proper classes?
I mean, take their example on a File type (http://golang.org/doc/go_tutorial.html):type File struct { fd int name string }
func (file File) Read(b []byte) (ret int, err os.Error) {}
func (file File) Write(b []byte) (ret int, err os.Error) {}
file := &File{fd, "file.txt"}
The same signatures in CoffeeScript can be achieved by:
class File
constructor: (@name) ->
read: (cb) ->
write: (contents) ->
file = new File "file.txt"Which I'm sure a majority of people would find a lot more readable.
Just for kicks I decided to rewrite Go's Cat example to StdOut in CoffeeScript for a side-by-side comparison. The examples are fairly close but not exact, i.e. cat.Go implements via streaming while CoffeeScript's is non-blocking.
https://gist.github.com/1207994
The CoffeeScript version ways in at 12 LOC, while Go's example is over 110 LOC and a lot more unfriendlier on the eye.