=== Top of the Swiki === Attachments ===

CommentOutCode

A problem with comments in Smalltalk, and most other languages, is inability to comment out comments, something I often want to do.

This makes the unwanted code into an unused block:

 myMethod
| a b c |

    [
"the old implementation"
a := Float pi squared. "lots of pies"
b := 10.0 sqrt. "sqrt of 10"
c := a * b "a root pie"
].

I don't know if Squeak optimizes this out like it should though. -- BobHartwig

I generally prefer doing something like

  myMethod
false ifTrue:[
"old implementation"
] ifFalse:[
"new implementation"
]

You can change this without adding and removing the closure. -- AndreasRaab