Thursday 23 April 2009

PrintString Mysterious Scriptaculous Seaside

Well, you have to be an insider to guess what that means or you read this post about some mysterious internals of Seaside.

Scriptaculous is a widespread JavaScript library, for which there is a Smalltalk interface to Seaside and which is used frequently by Smalltalkers using Seaside (as for as I know). This post is only about the interface between Seaside and Scriptaculous and this has nothing to do with Scriptaculous itself.

Today I was debugging some JavaScript code and I therefore had to frequently look into the inspector. For most classes we have modified the display messages for the inspector so that all vital information (instVars) is presented right in the inspector without having to dig into details.

I did the same to three Scriptaculous interface classes by changing the "printString" to my needs. I then continued with testing and suddenly: Rien ne vas plus! Everything was broken, nothing worked anymore.

I looked at it and found out that the authors of this Seaside to Scriptaculous interface used the "printString" for writing JavaScript, for directly converting the values of instances to JavaScript!

What a nuisance!

There is just no sense in this! Why not implement a special "asString", "asStringJS" or some "valueForJavaScript" or a "asJavaScript" or whatever. Buch why the fuck use this common printString, which is used by inspectors, debuggers and so forth and which is modified by many programmers to their taste!?

This is a self-destructive Seaside programming style. The worst I have ever seen in Smalltalk!

2 comments:

  1. ...because the interface was done by someone with very few knowledge of Smalltalk.

    ReplyDelete
  2. ...my instant thought was "just like the rest of Seaside" but that would be neither fair nor true. Just sarcasm.
    :-D

    ReplyDelete