hmm at heeg.de
Wed Jan 2 10:23:59 UTC 2008
Igor Stasenko schrieb:
> Some languages, like Pascal stopping parsing source when reaching some point.
> In Pascal it's the 'end.' sequence. You can put anything beyond that input.
> In smalltalk, we also could have such feature: no reason to parse text
> beyond the last return statement, because it's not reachable.
> Interesting that current compiler barfs on code past the return
> statement, saying that there's nothing expected after return.
> I don't like such behavior: Sometimes i need to stub-out some code, to
> test/debug methods, and i can't simply put ^self in the very beginning
> of method (it forces me to put '[^self] value' instead, just to get
> around such 'cleverness' of compiler ).
> Very inconvenient and useless feature, as for me, and it can be simply
> replaced by ignoring any input instead.
Sorry, I consider silently ignoring program text rather problematic.
In my experience, putting something in comment quotes or inside "false
ifTrue: " is pretty easy and preserves the simplicity.
If you want to be extra careful that such things never creep into
production code you could define a method BlockContext>>skipCode which
does just nothing, and wrap code to be skipped in " skipCode" :-) Of
course, you'd need to check for senders of this selector before
building, just as you would have to check for senders of #halt...
More information about the Squeak-dev