On Tue, May 26, 2015 at 9:38 PM, Peter Uhnák <[email protected]> wrote:
>> I vote for renaming to Rectangle>>translatedBy:, because it returns a new
>> translated rectangle instance.
>
>
> -1
> There is no benefit in renaming a single method, apart from creating more
> confusion.
I wouldn't say "no benefit". Consistent conventions are beneficial.
It could be useful to bring these into line with the general "-ed"
convention of returning a new object. I don't see how this would
create confusion, though it might create work. Whether its worth the
work is a slightly different question.
> If anything, the whole Rectangle API would have to be changed, as there is
> plethora of similar methods (expandBy:, extendBy:, merge:, etc.)
For a better feel of the work involved...
Rectangle methods select: [ :m | m sourceCode includesSubstring: '^
Rectangle ' ].
Rectangle>>#intersect:
Rectangle>>#quickMerge:
Rectangle>>#encompass:
Rectangle>>#intersect:ifNone:
Rectangle methods select: [ :m | m sourceCode includesSubstring:
'^Rectangle ' ].
Rectangle>>#intersect:
Rectangle>>#translateBy:
Rectangle>>#scaleBy:
Rectangle>>#merge:
Rectangle>>#compressTo:
Rectangle>>#expandTo:
Rectangle>>#roundTo:
Rectangle>>#truncateTo:
The following already follow the convention...
Rectangle>>#compressed
Rectangle>>#expanded
Rectangle>>#rounded
Rectangle>>#truncated
> Pretty much all Rectangle messages are immutable and create new Rectangle,
> thus I feel it is unnecessary to state it explicitly.
>
> In VW there is plenty of methods (e.g. left:) that mutates it, thus unlike
> Pharo a clear distinction is required.
Still, it is reasonable to consider the impact of inconsistent
conventions on the rest of the system outside of Rectangle.
cheers -ben