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

Search This Blog

Tuesday, July 06, 2004

Non-Surprises on the Slippery Slope of Language Jones'ing

Now it is Java's turn to play with young programmers' minds sliding downhill on the nature of unnaturally boxed objects.


How can a student think clearly with dull tools when they could otherwise move on toward thinking about problem domains instead of unboxing memory allocations.

From "Structure and Interpretation of Classical Mechanics"...

The advantage of Scheme over other languages for the exposition of classical mechanics is that the manipulation of procedures that implement mathematical functions is easier and more natural in Scheme than in other computer languages. Indeed, many theorems of mechanics are directly representable as Scheme programs.

The version of Scheme that we use in this book is MIT Scheme, augmented with a large library of software called Scmutils that extends the Scheme operators to be generic over a variety of mathematical objects, including symbolic expressions. The Scmutils library also provides support for the numerical methods we use in this book, such as quadrature, integration of systems of differential equations, and multivariate minimization.

The Scheme system, augmented with the Scmutils library, is free software. We provide this system, complete with documentation and source code, in a form that can be used with the GNU/Linux operating system, on the Internet at http://www-mitpress.mit.edu/sicm.

This book presents classical mechanics from an unusual perspective. It focuses on understanding motion rather than deriving equations of motion. It weaves recent discoveries in nonlinear dynamics throughout the presentation, rather than presenting them as an afterthought. It uses functional mathematical notation that allows precise understanding of fundamental properties of classical mechanics. It uses computation to constrain notation, to capture and formalize methods, for simulation, and for symbolic analysis.


Jim points out that more flexible languages like Smalltalk and Lisp have issues with "identity" and "equality". He also makes the point though that the more useful notion of "equality" is typically employed in Smalltalk via = (and by the way in Scheme via equal? versus eq?).

In the common rigid languages, unfortunately, the typical programmer uses identity everywhere, which is just an artifact of those languages' rigid foundation in squeezing an instruction or two out of the code here and there. "Hey, let's use an identity test for equality because it's *fast* and it's meaningful a lot of the time." Only now, it's not.

I just wish in Smalltalk "identity" wasn't the easily confused == and in Scheme I wish eq? was a more distinguished symbol like identical? or even something better. Maybe in Smalltalk, #isIdentical: anObject. But it's decades too late.

1 comment:

Ian Bicking said...

It seems to me that C-based languages don't confuse identity vs. equality because of performance, but because of those damn pointers. The C == operator truly tests for equality, but testing the equality of pointers is the same as testing the identity of objects. Many higher level languages lack pointers and universally use call-by-reference: Smalltalk, Scheme and other Lisps, Python (but not Perl or PHP for some reason). This simplifies things incredibly -- but it hides a few things, which is why they need the separate operators. (But since identity and equality are trully different concepts, they deserve different operators anyway.)

I suppose Java is a little funny here, because it doesn't have pointers but still inherits lots of things from C that only make any sense at all if you have pointers. Stupid Java.

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.