Yes. And, into the other direction, even in good core methods one often finds things like

 ^ dict at: aKey ifAbsent: [nil]

There seems to be a "natural" confusion between "object" value and block "value".

What's the problem with that ? Yes, 'nil value' answers nil but 'nil' is not a block and #at:ifAbsent: waits for a block (the parameter is called aBlock). It is shorter to write 'nil' directly I agree.


What is more problematic in my point of view is code like this:

AbstractLauncher>>parameterAt: parName ifAbsent: aBlock
  "Return the parameter named parName.
    Evaluate the block if parameter does not exist."
  ^self parameters
    at: parName asUppercase
    ifAbsent: [aBlock value]



It may be me (still a beginner), but it looks equivalent to

  ^self parameters
    at: parName asUppercase
    ifAbsent: aBlock


which is faster and clearer in my opinion.
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to