On Go’s Type Parameters Proposal

The developers of Go have release a new draft proposal for type parameters. The biggest change is the replacing the concept of constraints, which complicated the proposal somewhat, and replaced it with interfaces to express the same thing. You can read the proposal here latest proposal here.

I think they’re starting to reach a great balance between what currently exists in the language, and the features required to make a useful type parameter system. The use of interfaces to constrain the type, that is declare the operators that a type must implement in order to be used as a type parameter for a function or struct, makes total sense. It also makes moving to type parameters in some areas of the standard library trivial. For example, the sort.Sort function prototype:

func Sort(data Interface)

can simply be written as:

func Sort(type T Interface)(data T)

I do have some minor concerns though. The biggest one is the use of interfaces to express constraints related to operators, which are expressed as type lists. I think listing the types that a particular type parameter can instantiate makes sense. It dramatically simplifies the process of expressing a constraint based on the operators a particular type supports. However, using the concept of interfaces for this purpose seems a little strange, especially so when these interfaces cannot be used in areas other than type constraints. To be fair, it seems like they recognise this, and I’m suspecting that in practice these interfaces will be defined in a package that can simply be used, thereby not requiring us to deal with them directly unless we need to.

But all in all, this looks promising. It is starting to feel like the design is coming together, with the rough edges starting to be smoothed out. I appreciate the level of careful consideration the core Go developers are exhibiting in this process. This is after all a large change to the language, and they only have one real chance at this. Sure we have to wait for it, but especially in language design, mistakes are forever.

Don't Get it Now

It’s scary times at the moment. The Corona Virus (SARS-CoV-2 and Covid-19) is raging through Europe at this moment, with hundreds of people dying in Italy, Spain and France and most of the those countries, along with the US, in lock-down. The hospital system is currently not equipped to be able to handle the peak number of patients that will require intensive care: doctors from Italy, France and New York are telling stories about how they have to choose who lives and dies, and I’m fearful that we may start hearing stories like that here. There is currently no cure, nor no treatment. There’s been models indicating that even if we take steps to suppress the virus now, there will be continuous surges in outbreaks until a vaccine is ready in 12 to 18 months, suggesting that we may need to be in a state of lock-down or at the very least, rigid social distancing until August 2021 at the latest. The WHO reckons that a majority of the worlds population will get infected over the next year.

I’m not an doctor, nor an etymologist. I cannot begin to suggest what we should do as a society. But I’m going to give a few thoughts as to how I plan to weather this storm.

I think at this current stage, our enemy, along with the virus, is time. I hope I don’t have to tell you that the virus is moving through the worlds population now, even as we speak. But humanity is not standing still either:

  • We are researching the hell out of this thing. One such example is on Tuesday we learnt how the body reacts to the virus, which could help with understanding how best to treat it. Along with this, there are still some very important unanswered questions about the [actual death rate and transmission rate](www.abc.net.au/news/2020… coronavirus/12068106), as well as [whether heard immunity will work](www.abc.net.au/news/2020… 19-twice/12075878), that we’ll hopefully get the answer to soon.
  • We’re started clinical trials of potential treatments, and a vaccine. It’s still early days at the moment, and we probably won’t have anything ready soon, but the early indications of this sounds promising.
  • And, if the above should fail, we are (should?) be ramping up our hospital capacity to handle the influx of patients, meaning that if someone should unfortunately die from this, it won’t be because they didn’t have a bed.

So my mantra for the next few months is “don’t get it now.” Wait to get infected for as long as you can. The ideal case is not to catch it at all, but if we’re destine to get infected, best to get in infected later, when some of the points above have been addressed, instead of sooner when they have not. This will obviously mean sacrificing things like going to the gym, going out for coffee, or seeing friends and family. But I believe that this is a price worth paying, especially if the alternative is loosing someone you love, or potentially your own life.

So that’s my current strategy at this time. I don’t know if it will work, and as things develop it may need refining. But after thinking about this for the previous few weeks, it’s the best strategy I can think of. And I think it will help me get through this.

P.S. A lot of my thoughts on this came from reading this article by Tomas Pueyo. He’s obviously more knowledgeable about how we should act on this as a whole. It is worth your time reading this.

P.P.S. I spoke quite abstractly about the health system, but it’s important to remember that these systems are made up of people: doctors, nurses and paramedics on the front line, along with the researchers, manufacturers and logistics who support them. At this time, they are giving their all, and then some, to help us through this crisis. Once this is over, I think we owe every single one of these individuals a beer.

Update On 4th Dec 2022: Almost three years since writing this post, I tested positive for Covid-19 for the first time. My symptoms were that of a pretty rough cold which, given what the possibilities could have been when I wrote this post, meant that I weathered the disease pretty well. I finally caught it at a time when vaccines and treatments were wildly available and I was up to date with my inoculations. So all in all, I’m glad the whole “don’t get it now” worked in my favour.

Reflections On Virus Scanners on Windows

I was listening to Episode 277 of The Talk Show in which John Gruber was discussing virus scanners on Apple Macs with John Moltz. The discussion turned briefly to the state of virus scanners on Windows, and how invasive these commercial scanners were compared to Windows Defender provided by Microsoft.

Hearing this discussion brought memories of my experience with virus scanners back in the days of Windows XP and earlier. There was no Microsoft Defender back then so we had to have a license for one of the commercial scanners that were sold to home users at the time, such as Norton AntiVirus. Given how insecure Windows was back then, it was one of the first things we had to put on a fresh install of Windows. And these things certainly slowed Windows down. But we recognised that it was necessary and after a couple of weeks, we eventually got use to it.

However, after setting up a new install, there was this brief period of time when we got to experience Windows without a virus scanner. And the difference in the user experience was significant. The boot processed was fast, the UI snappy, and the applications quick to launch. In fact it was so good, it felt strange and slightly uneasy, as the knowledge that there was no virus scanner protecting the system was evident. Only after the virus scanner was installed, with the resulting hit in performance, did it fell safe to use Windows again. It was not until I listened to this episode that I realised how perverted this feeling is.

I cannot imagine how it must feel for those Microsoft developers who worked hard on providing a user experience that was responsive only to see it slowed down on almost every machine by a virus scanner. I’m sure they knew that, due to the prevalence of malware for Windows back then, it was necessary. Still, I could not imagine that they would have been thrilled about it.

New Home of Steve Yegge's Rant About Google Services

I’ve always enjoyed this rant from Steve Yegge about how Google differed from Amazon in how they develop their services. Not sure if it’s applicable now but it was quite interesting to hear how the two companies differed in their approach in building and releasing products. After hearing that Google+ was being shutdown, I wondered what would happen with the rant, and whether it would be lost to time. It was fortunate that someone saved it.

For those of you who haven’t read any of Steve’s other blogposts, please checkout his current blog, plus several of his other Drunken Blog Rants. They are well worth your time.

Five Common Data Stores and When to Use Them

Very interesting post on the Shopify Engineering Blog on the difference between 5 types of data-stores available to developers, and under what circumstances they should be used.

I find it tricky to decide on the best technology for storing data for a particular project. I guess the important thing to keep in mind is to try and figure out as best you can how the data is going to be used (i.e. queried). If you know that, the decision should be easy once you know what’s out there, and this blog post certainly helps in this regard. If you don’t, I guess the next best thing is to try to find the option that will give you the most flexibility with hopefully not too much loss in performance.