Categories
Programming

Great Research and Mental Clutter

You and Your Research is an excellent talk made by Richard Hamming (of “hamming code” fame) in 1986.

On a related note What to do with things to do is a good idea for sorting out mental clutter. What do you want to grow or restore? What things just need maintaining? What should you prune and what can you close?

Categories
Programming

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!

Categories
Programming

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 ..

Categories
Edinburgh

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.
Categories
Programming

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.