Sept. 2, 2015
10:29 a.m.
Le 2/9/15 10:56, Peter Uhnák a écrit :
Hi,
in Spec Adapter there's method
widgetDo: aBlock ^ self widget ifNotNil: aBlock
my question however is: does the naming make sense?
Not even the naming. I would say. lot of code in spec should be rewritten. The holder should be most of the time directly exposed to reduce the API.
#*Do: is generally associated with iterating over collections. Widget is always a single entity. On the other hand we have #ifNil: #ifTrue: #ifFalse:
There is also #ifNotNilDo:, however that is superseded by #ifNotNil:
So from this perspective, wouldn't it make more sense to have this? ifWidget: aBlock ^ self widget ifNotNil: aBlock
What do you think?
Thanks, Peter