"I have a mind like a steel... uh... thingy." Patrick Logan's weblog.

Search This Blog

Friday, November 02, 2007

Optional "Type" Declarations

I realize ActionScript, like some other dynamic languages, have optional type declarations.

I don't care for static types, optional or not, declared or not. If you want speed, there's other ways to get it. If you want safety, there's other ways to get better safety. If you want documentation, they document the wrong thing.

Alan Kay pointed out a long time ago the benefit of message passing and "duck typing" if you will. I am a huge fan.

3 comments:

Barry Kelly said...

I don't really see why the anger towards static types.

A type is just a set of invariants which hold for values of the type. Probably the biggest benefit this delivers is inter-version compatibility in a marketplace of components - people can release new versions and be fairly (i.e. very) sure that they won't break existing clients, because of the type system. The other benefits, like performance, documentation and compiler checking of invariants are gravy - and not unimportant gravy either, depending especially on what end of the performance wedge you're on.

Patrick Logan said...

I no longer get into debates about static types. Searching for debates, even with my name, will turn up all the basic arguments pro and con. I fall fairly into those arguments you will find in favor of dynamic languages.

Having said that, be aware that right now I am trying out JoCaml, which is based on a type inferencing system like ML's. So far so good, better than the more elaborate type inference systems like those found in Haskell or even Scala.

Barry Kelly said...

OK, I've done the basic Google search, "patrick logan static dynamic type", and I can't quite make out the bit where there's an argument why people who find static types useful are wrong.

Assertions about message passing and duck typing being useful are all well and good, but they aren't related to static typing - even C++, for all its static yet weak typing, uses duck typing in its templates, while the metaphor (if not the generality) of message passing is at the core of OO.

It's just that the impression I get is that you'd rather people who find static types useful should be marginalized, without an argument why.

FWIW, I see benefits to both weak and strong typing, and to both static and dynamic typing, though I'd rather stay away from a combination of weak and dynamic. I don't see the point of polarizing, and being dogmatic, though.

Ah well.

Blog Archive

About Me

Portland, Oregon, United States
I'm usually writing from my favorite location on the planet, the pacific northwest of the u.s. I write for myself only and unless otherwise specified my posts here should not be taken as representing an official position of my employer. Contact me at my gee mail account, username patrickdlogan.