February 2nd, 2005

  • evan

type-inferencing python

Interesting post on the O'Caml list in response to someone looking to add type inference to Python by someone who actually looked into doing it:
Python specs weren't written by someone knowing about languages and standardisation. By far the worst problem was exceptions. In many cases errors are specified to throw exceptions... which means the behaviour is well defined.

This alone make static type analysis almost impossible. To do static typing you need a specification that says the result of a wrong typing is undefined. Otherwise the program can *rely* on catching an exception, and a type error isn't an error (since the behaviour is well defined). Trying to explain that to Pythonistas and van Rossum in particular proved difficult.. although they seemed to understand the problem which dynamic mutations to modules caused and considered 'freezing' modules after they'd been imported. This may have been done in later versions of Python: some changes to 'eval' and friends were made for his reason (you have to specify the dictionary to use for an eval now).

> 1. analyse all the constraints of the code
> Ex:
> def f(a): a.append(1)
> def g(a): a=a+1; f(a)
> g('coucou')
> => a must support append

No, you cannot assume that due to the 'exception' problem mentioned above.

> => a must also be an int

And you can't assume that either. A could be a class with an __add__ method. Alternatively, it could be anything, and the called of g() is again relying on a type error to throw an exception.
  • evan

jwz quote

I had a meeting on Monday where the presentation began with the jwz quote:
Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.
So, so, true.

But because it’s usenet it becomes a flame war, of course. But there are some other zingers:
  • > To me perl is the triumph of utalitarianism.

    So are cockroaches. So is ‘sendmail’.
  • I’ve been hacking C (it’s not just a language, it’s a grade) ...
  • Maybe someday, the language that practicality makes us settle for will also be one that doesn’t suck quite so much as the current crop do. Maybe we won’t be “settling” at all.

    I expect this will be about the time we’re all buzzing around on jet packs, living in automatic houses, and driving nuclear-powered cars.
  • evan

hate computers

I can't download my mail, getting connection refused; I asked Brad about it and he tells me he turned off access because of a new security hole in
(wait for it, it'll surprise you)
(Hahahah! Just kidding about the surprise!)

We looked through the diff: it appears if your login fails enough times it just lets you login anyway.

(Not that this is an IMAP problem, but while we're on the subject: As far as I can tell IMAP is another one of those protocols where it sucks but nobody can replace it because if they do it'll just seem like a NIH problem. So nobody implements it because it's crap, but nobody can fix it either.)

PS: When/why did I become so cranky?