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

Search This Blog


Friday, April 23, 2004

Angels dancing on heads of pins and all that

We used to see all kinds of analysis of what kind of C code is generated from the original CFront pre-compiler for AT&T's C++. The C programmers were obsessed. We still see the same kind of obsessions in the dotnet world for some reason, much more than we saw in the early days of Java.

In Smalltalk (yeah, I know: it's "nyah! nyah!" time again) all "control flow statements" are done by sending objects messages. This "hard coded" statement...

for (int i = 0; i < foo.Length; i++) {}
becomes this message send (named #to:do: which can be redefined, inherited, etc. as with any message)...
1 to: foo length do: []
...and then we leave it to the compiler to generate efficient code most of the time, and get on with our lives.

If you are worried about the efficiency of a for loop in C#, more than the number of iterations, and more than the efficiency of the body of the loop itself, well, then might I suggest you are either worrying about the wrong thing or you are using the wrong language.

Angels dancing on heads of pins, and all that.

No comments:

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.