~/devreads

#generics

9 posts

3 Sept 2018

Dave Cheney 3 min read

This is a short response to the recently announced Go 2 generics draft proposals Update: This proposal is incomplete. It cannot replace two common use cases. The first is ensuring that several formal parameters are of the same type: contract comparable(t T) { t > t}func max(type T comparable)(a, b T) T Here a, and […]

goprogramminggenerics

29 May 2018

1 Nov 2017

Adam Chalmers 5 min read

If you want to make Swift programmer shudder, just whisper the words “associated types.” They’re one of the few Swift language typing features you’re unlikely to find in other programming languages, so they can take some getting used to. Last week I tried to write a seemingly simple function, and ended up spending most of my day diving down the…

associatedtypegenericsswiftprogrammingcomputer-science

22 Jul 2017

Dave Cheney 3 min read

A long time ago, someone–I normally attribute this to David Symonds, but I can’t be sure he was the first to say it–said that the reason for adding generics to Go would be the reason for calling it Go 2.0. That is to say, adding generics to the language would be half baked if they […]

goprogramminggenericsgo2.0

18 Jun 2017

Dave Cheney 7 min read

In my previous post I discussed my concerns the additional complexity adding generics or immutability would bring to a future Go 2.0. As it was an opinion piece, I tried to keep it around 500 words. This post is an exploration of the most important (and possibly overlooked) point of that post. Indeed, the addition of […]

goprogramminggenericsimmutability

14 Jun 2017

Dave Cheney 2 min read

Fifteen years ago Python’s GIL wasn’t a big issue. Concurrency was something dismissed as probably unnecessary. What people really was needed was a faster interpreter, after all, who had more than one CPU? But, slowly, as the requirement for concurrency increased, the problems with the GIL increased. By the time this decade rolled around, Node.js and […]

goprogrammingsmall ideasgenericsgo2.0

21 Apr 2016

lukaseder 1 min read

A very interesting question was posted to Stack Overflow and reddit just recently about Java generics. Consider the following method: While the unsafe cast seems a bit wonky, and you might guess there’s something wrong here, you can still go ahead and compile the following assignment in Java 8: This is obviously wrong, because Integer … Continue reading The Parameterless…

javajava 8generics

16 Feb 2016

30 Apr 2015

lukaseder 1 min read

I admit, we’ve been lured into using this technique as well. It’s just so convenient, as it allows for avoiding a seemingly unnecessary cast. It’s the following technique here: Now you can type safely assign anything from the wrapper to any type: This is actually the API you can use when you’re using jOOR, our … Continue reading This Common…

javaantipatterncompilergenericstype safety