Thoughts on Whatnot
A blog about .
Feedback for Go 2 Design Drafts
Recently, draft design documents were released by the Go development team detailing what the members of the team have been thinking about and researching for the development of features for Go 2. Specifically, these cover potential plans for error handling, changes to error values themselves, and generics. While I haven’t gotten a chance to read through the documents on error values yet, I have read the sections on error handling and generics.
Introducing WDTE
This last semester, I took a class on compiler design. Towards the end of the semester, I suddenly realized that something I’d been mildly interested in working on for a while was in fact quite a bit easier than I had originally expected: Writing my own scripting language. I began work on it and had a working prototype in just a week or two. I worked on it pretty much non-stop for a bit, and I had originally intended to write this introduction back a few months ago, but some stuff came up and I was busy and… Either way, here it is.
Composition vs. Inheritance
There’s a situation that, while it doesn’t happen too commonly, annoys me when it does happen. Someone comes to Reddit, or golang-nuts, or somewhere else, and asks about the often repeated refrain about composition vs. inheritance. Sometimes, they get the right answer. Sometimes, someone makes some out-of-nowhere remark about embedding. The problem is that embedding is not in and of itself composition. It can be used in composition, but composition is not a syntactic or behavioral choice in the language; it’s a design pattern.
Go Plugins
The release of Go 1.8 inches steadily closer, bringing with it many interesting and useful features and improvements, including shorter compilation times, an even faster GC, and, my personal favorite, initial support for plugins. Plugins, essentially Go’s version of C’s dlopen() and related functions, are an interesting one. The ability to dynamically load packages at run-time has been one of my most wanted features in Go since I first figured out how interfaces work.
Redefining Go Templates
In Go 1.6, a new template action was introduced in the text/template package that allows for both defining and executing a template at the same time. This action, block, seems at first to be somewhat pointless. Even the docs describe it as simply being shorthand for defining and then immediately executing a template, and what’s the point of that? Why would you want to execute an inline template immediately after defining it?
Interfaces and nil in Go
The oddity that nil interfaces can be in Go is one that has caught a number of people off guard. After explaining it multiple times on Reddit and elsewhere, I figured it would be a good idea to have an article I can refer to. Since I’m attempting to start a little blog here, I thought this might make a good first article. The problem is pretty simple. It’s very possible to have what appears to be a nil interface in Go which is, in fact, not nil.