Ownership types

I was reading the OOPSLA ’02 proceedings and found the paper on Ownership Types for Safe Programming. This is a static type system for multi-threaded programming. The claim is that a well-typed program in this system is guaranteed to be free of data race-conditions and deadlocks. Wow! Okay, I’ll read more and see what the catch is. Dependent types seemed cool, until I read about the undecidability!

Static typing vs. dynamic typing

The small corner of the blog world which I live in (need a name for that concept) has recently started debating dynamic typing vs static typing (and I’ve already refuted some claims). I’m of the view that static typing is a big benefit especially in large systems where no one person understands everything. As ever, there are pros and cons to both approaches, so here’s another braindump of ideas and opinions ..
Continue reading “Static typing vs. dynamic typing”

Emacs Fun

I’ve been using emacs for nine or so years, and I’m still discovering cool stuff it can do. That’s probably a bad thing, since a good application will lead a user to naturally discover it’s feature set – anything from “tip of the day” to well structured UI design.

Anyhow, here’s a list of things which I’ve uncovered, mostly from the emacswiki.

  • Wiki modes for editing an existing wiki, or for maintaining your own one locally.
  • Flymake which does on-the-fly syntax checking as you type source code
  • Mouse gestures for emacs
  • Session management so that emacs remembers all the recent used files, commands etc.
  • eldoc-mode, which displays function args in the minibuffer when you’re editing a function call.

STL transform() meets constructors

Using the STL transform() function you can apply “function like things” to a collection to make a new collection. That means anything which can be called by sticking brackets after it, so functions are fine and function objects are fine.

But not all “function like things” work. What happens if you have a collection of ints, and you want to transform them into a collection of Foo’s, where the constructor for class “Foo” takes a single integer argument.

Well, you can’t just pass “Foo” to transform() because that’s a type, not a value. You can’t pass Foo::Foo either, It doesn’t work.

You can create a static method, say Create(int i), which just builds a Foo object and returns it. That works. But it’s incredibly inelegant.

Catching up with Alan Kay

Alan Kay is someone who’s opinion I value. He has had many great ideas. I’m still playing catchup with ideas he had decades ago.

As a computer programmer I tend to view computers as, well, compute-rs. I think of them doing computer stuff. With the internet, I think of them as endpoints for moving data around – music, information, instant messaging. I live in a world of protocols, tools and document formats.

I recently dived into the blogging world, and that was a huge new internet-time flow of information. But at the end of the day, networks just let people communicate. It’s still just a network of people. All the clever network magic doesn’t create anything new. The blog world isn’t very exciting if people are just recycling links to the latest cool web page. It’s only exciting when people are writing original content.

So my epiphany is that, in the Alan Kay world, you don’t look at computers as compute-rs. You look at them as pencil and paper on steroids. You don’t use them to write yet another naff utility. You don’t do computers – you explore the world and you use the computer as your scratch pad, your laboratory, your experiments, your classroom. Imagine if Newton had Mathematica! Imagine if Leonardo had a laptop. Maybe they’d waste their time surfing the latest cool website, or maybe they would have used to do even more real stuff.

I do a lot of music recording and editing on my computer. So, I do use it as a tool. But I don’t think of it as an instrument. I’ve heard less geeky people describe their iMac as an instrument, but I can’t stop myself hearing the bytes flying around.

I think I’ve been programming too long. I couldn’t see the wood for the trees.

So now I understand why Alan Kay wrote Squeak. It’s not about teaching kids how to become programmers. It’s about letting them explore the world using something hugely more powerful than pencil and paper. You’re not giving them a fish – you’re teaching them how to fish.

Now, maybe twenty-five years from now I’ll have a similar epiphany about what the hell Alan’s latest venture, Croquet is all about. The tagline is obviously a good idea – “if we were to create a new operating system and user interface knowing what we know today, how far could we go”. But how far is Alan Kay going to go?