Home | Writings | Resume | Links | RSS Feed
A Proud Member of the Reality-Based Community
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
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.


