On 13-01-16 18:38, David Allouche wrote:
Why did you use a single expression instead of using a temporary variable? I 
find it harder to understand.

I did find it very slightly easier to understand. It is not a strong opinion however.

The ideomatic smalltalk would be

^#(leftFraction leftOffset topFraction topOffset rightFraction rightOffset bottomFraction bottomOffset)
        inject: self species hash into: [:hashValue :selector |
                (hashValue + self perform: selector) hashMultiply ]

but that would be slower.

I would be tempted to add a binary message

Integer>>+** aNumber
        ^(aNumber +self hash) hashMultiply

(I'd prefer +#*, but that doesn't parse)

hash
        ^self species hash +**
        leftFraction +** leftOffset +**
        topFraction +** topOffset +**
        rightFraction +** rightOffset +**
        bottomFraction +** bottomOffset



Stephan


Reply via email to