Wednesday, April 13, 2011

Petite Horloge revisited

Another Pharo Smalltalk snippet with temp classes (I like this :)

(Class new
    superclass: StringMorph;
    setFormat: StringMorph format;
    compile: 'step self contents: Time now printString';
    new)
        openInWindowLabeled: 'Petite Horloge'.


Don't forget the setFormat: or the VM will crash.Some explanations.

2 comments:

  1. Shouldn't you also call the superclass step too, in case it's doing something?

    ReplyDelete
  2. Yes that would be better.

    Actually StringMorph>>#step is not defined and Morph>>#step is empty.

    ReplyDelete