Patrick M Brennan
Home | Writings | Resume | Links | RSS Feed
A Proud Member of the Reality-Based Community
About Me : I'm a grownup nerd living in the Boston burbs. I write computer programs for a living and plays for fun. I'm married to a wonderful woman, and we share a nice little house with our daughter and our cats. I'm a humanist, a technologist, an artist, and an idealist. I believe in reason, freedom, love, equality, and democracy. (Did I mention that I'm an idealist? I did, OK.) I'm also a pragmatist and an empiricist. I reject ideology and dogma, especially when they conflict with practical facts (i.e., pretty much always). I particularly hate willful ignorance, which tends to go hand-in-hand with ideology and dogma.
Like the alignment of the planets, this blog gets updated as I have the time, inspiration, and inclination to do so.

Thursday, July 17, 2003

Unbelievable ActionScript

I write Flash code for Applied Messaging Corporation, where I've had an excellent opportunity to observe firsthand some of the silliness of Flash. For example, I have the following code buried somewhere in the thousands of lines which I've written:

gServer.handler.onNotificationCancel = funtion(notificationId)
{
shTrace("in gServer.handler.onNotificationCancel");
gAlertList.removeAlertID(notificationId);
}


It compiles fine; Flash gives me no errors and there is no indication whatsoever that anything has gone amiss. However, when I run the application and look at the copious logs we generate (we've learned you need to do this when you write in Flash), I notice that the function never gets called from the place where it's supposed to be called. This is odd... so I turn to another tool, a custom in-house Flash debugger which I built. I check here and I notice that when I evaluate the function, it's undefined! Hmmm. What could be wrong? Then I notice (after about 15 minutes of staring at the code): I spelled "function" wrong!!! The code is supposed to look like this:

gServer.handler.onNotificationCancel = function(notificationId)
{
shTrace("in gServer.handler.onNotificationCancel");
gAlertList.removeAlertID(notificationId);
}


Silly me, I expected the compiler to detect that!

You know, it's 2003. There's no excuse for a compiler to allow syntax errors to go by unnoticed. This may just be a bug, but I doubt it. This is a fundamental design flaw in the Flash compiler. Flash didn't even issue a warning about this code! I don't think it should be necessary for a programmer to be a perfect speller, and I don't think it should be necessary for a programmer to slavishly inspect his code to make sure the syntax is correct. Damn it, that's what computers are for! This single incident has nearly deadened my enthusiasm for developing in Flash.


posted by Patrick M Brennan 2:37 PM | link

Patrick M Brennan Programmer, Playwright, Righteous Geek