Just Play It Grand...


Class variable syntax check upon declaration

Posted in Squeak by eric on the July 7th, 2007

I went to create a Singleton and for a second I had to think how to actually do this. I code alot of Objective-C, and its funny how your brain really gets rewired. In Objective-C you would declare a static variable, which is its way of defining a class variable. It seems that after a long time of doing this I didn’t really think of it that way (in ObjC), I just thought of it as a static variable, in the C sense. So it takes a second to step back and think, what am I doing again?

Anyway, I went to declare the class variable in the Class definition. I entered… ’sharedAddressBook’, performed a save of the editing window. A debugger window appears. Huh?

ClassDefDebug

Ok, first time through I didn’t even read it and just clicked Proceed. I thought maybe its a bug in Squeak. But then I got wondering, why did a debugger window come up? So I undo the operation and do it again. Ah, it’s telling me a style recommendation and I can ignore it by clicking Proceed which will infact go ahead and declare it and save the editing window OR I can Abandon it and it returns me back to the Class declaration with no save occurring. Cool…

It’s nice to be presented with something like this. It’s proactively saying, hey, you may want to reconsider this as you may have a) typed it wrong or b) you are new around here aren’t you? Why yes I am.

Technorati Tags: ,

Leave a Reply