Etoys V3

一週間ほど前に新しいファイルをまとめてアナウンスしたと書いたが、どうしようもないミスをしてしまっていた!いいわけ不能の間違いなのだが、それほど致命的でもないという説が有力なので、新しいファイルを同じ名前で出しなおしてしまった。

ということを書いたメールの中に、以下のようなコードがある。ややこしいところを除けばすべてのクラスのすべてのメソッドをコンパイルしなおして(categoryは結局使っていないので意味なかったな。selectorsでよかった)、コンパイル前のものと同じになるかどうか比較しているのである。

| meth newMeth name |
col _ OrderedCollection new.
Smalltalk allClassesDo: [:c |
  {c. c class} do: [:cls |
    cls compilerClass = Compiler ifTrue: [
      cls organization categories do: [:cat |
        (cls organization listAtCategoryNamed: cat) do: [:sel |
          (name _ cls name, ' ', sel) displayAt: 700@75.
          meth _ cls compiledMethodAt: sel.
          ast _ cls compilerClass new compile: (cls sourceCodeAt: sel) in: cls notifying: nil ifFail: [self halt].
          newMeth _ ast generate: meth trailer.
          (sel ~= #cacheTempNames: and: [sel ~= #setTempNamesIfCached:]) ifTrue: [
            meth = newMeth ifFalse: [col add: name]]]]]]].

この中で、#cacheTempNames:と#setTempNamesIfCached:がなぜ除外されているか、試さずにわかった人にはスーパーSqueakマスターの称号を得るための得点を5点と、娘のかわいい写真を一枚差し上げます。