Richard Bucker

GoLang Generics and K&R Troll

Posted at — Jan 4, 2015

Just this morning I read a blog post disparaging The definitive introduction to the C programming language ("The C Programming Language") by someone who professed to be a published author. Unfortunately he had disabled the comment section of the blog suggesting that “we” write our own blogs. This, however, is totally disingenuous as the blogger is actually trying to generate SEO-type traction instead of spreading idea or starting a dialog.While the K&R book was not meant to be a demonstration of idiomatic C coding style it was the standard at the time… and it has evolved nicely since. At the time the language was written the only operating system of consequence that was written in it was from Bell Labs. DOS, CPM and most other PC-basd operating systems were implemented in Assembler. If memory serves me all buy about 70 lines of the original Unix systems were written in C. C was intended to be a systems language.This nameless blogger simply does not know enough history to justify his position.**The GoLang Generics war is heating up and frankly I do not understand why. Go supports features which reduces the actual need for Generics. ┬áJust look at the sort package in the stdlib. In a way it looks like a cross betters a JavaScript callback and the original C-lang sort.In 35 years as a professional programmer I have always felt coerced to use generics. They never made my programs better, faster, easier to maintain or even easier to read. They promoted a blackbox mentality that object oriented programmers prefer as demonstrated by implementing access levels. Proper idiomatic Go programming will always be better than polluting the language spec with generics. (when the only tool is a hammer then all problems look like nails.)