Because Smalltalk lacks a "switch/case" control flow structure? :)


Esteban A. Maringolo


2014-06-27 15:42 GMT-03:00 Denis Kudriashov <[email protected]>:
> I always wondering how anybody can write such code with smalltalk
>
>
> 2014-06-26 0:43 GMT+04:00 stepharo <[email protected]>:
>
>> because when I see code like that, it makes me sick!
>> I wonder also when we migrate to Athens if we will not rewrite all that
>> anyway.
>>
>> fillRectangle: aRectangle basicFillStyle: aFillStyle
>>     "Fill the given rectangle with the given, non-composite, fill style."
>>
>>     | pattern |
>>
>>     (aFillStyle isKindOf: InfiniteForm) ifTrue: [
>>         ^self infiniteFillRectangle: aRectangle fillStyle: aFillStyle
>>     ].
>>
>>     (aFillStyle isSolidFill)
>>         ifTrue:[^self fillRectangle: aRectangle color: aFillStyle
>> asColor].
>>
>>     "We have a very special case for filling with infinite forms"
>>     (aFillStyle isBitmapFill and:[aFillStyle origin = (0@0)]) ifTrue:[
>>         pattern := aFillStyle form.
>>         (aFillStyle direction = (pattern width @ 0)
>>             and:[aFillStyle normal = (0@pattern height)]) ifTrue:[
>>                 "Can use an InfiniteForm"
>>                 ^self fillRectangle: aRectangle color: (InfiniteForm with:
>> pattern)].
>>     ].
>>     "Use a BalloonCanvas instead"
>>     self balloonFillRectangle: aRectangle fillStyle: aFillStyle.
>>
>

Reply via email to