Since the beginning of my internship, I have been playing with Mezzo, writing some code, and, more specifically, trying to see how the notion of typestate could be expressed with Mezzo’s permissions. As an application, I tried to write in Mezzo an iterator on lists. What I call an iterator is here more like Scala’s Iterator , or a bit like what Gabriel called generators in a previous blog post.
This example turned out to be subtle enough to write in Mezzo: in this post, I’ll try to show you the details of the implementation, leading to a fully working implementation of list iterators. I think it’s a good opportunity to see an implementation of a (very simple) typestate, and also some funny tricks with Mezzo’s permissions.
This blog post is from Arthur Charguéraud, whom we recently had the pleasure to see again in Rocquencourt. It comes from a recent submission to the OCaml 2013 Workshop, and is a discussion of some things that could be improved to make OCaml a better teaching language.
Of course, while everyone agrees in principle that tooling is good
and that making the language simple to learn (and teach) is a noble
cause, the details of the proposal are controversial. We hope that our
dear readers will understand this as a first position statement to
stimulate discussion and contribution, rather than a cause for outrage –
although some here would agree that suggesting
!r as a
lvalue is somewhat heretic.
I am neither a Java aficionado nor a Java guru, but I use it as a vehicle for teaching programming at an undergraduate level.
In this post, I describe a simple situation where the need for a self type arises in Java. I present a way of simulating a self type in Java, and also suggest that in this case, by changing the code slightly, one can avoid the need for a self type in the first place. None of these ideas is new, but perhaps they deserve to be more widely known.