[squeak-dev] Problems with #caseError

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Feb 18 15:23:50 UTC 2020


(Hit send to early, see below ...)


________________________________
Von: Thiede, Christoph
Gesendet: Dienstag, 18. Februar 2020 16:21 Uhr
An: Squeak Dev
Betreff: Problems with #caseError


Hi all,


there are two problems with #caseError.


First one:

Given the following example, you will receive a confusing error message:


#foo caseOf: {[#bar] -> [2]. [#baz] -> [3]}
"--> Error: Case not found (nil), and no otherwise clause"

Either #caseError should be called on #foo, then this would be compiler bug.
Otherwise, I don't see any reason to print out the receiver. We could also name it #caseError: anObject and print out this object, but the current message is not helpful IMO ...

Second one:
I'm not sure whether it is expected behavior how #allLiterals works on the following example:

method := Compiler new
compiledMethodFor: '#bar caseOf: {[#bar] -> [2]}'
in: nil to: nil notifying: nil ifFail: nil.
method allLiterals.
"-->  #(#caseError #bar #caseOf:)"

This can be confusing when searching for all users of #caseError. Should we handle this edge case in #allLiterals?

Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200218/62f922cc/attachment.html>


More information about the Squeak-dev mailing list