[squeak-dev] #caseOf:otherwise: -> Parser is way too cautious

marcel.taeumel Marcel.Taeumel at hpi.de
Sun May 29 08:50:51 UTC 2016


Hi, there!

I cannot write this without the parser complaining:

number caseOf: {
   0 -> 1.
   1 -> 1.
} otherwise: { ... }.

Because what I should write is this:

number caseOf: {
  [0] -> [1].
  [1] -> [1].
} otherwise: { ... }.

I think that this is not for the parser to decide. Numbers do understand
#value. Any object does. So this is fine. Am I missing something?

It reminds me of this mistake our students typically make at least once:

(someBooleanExpression) and: (someOtherBooleanExpression)
versus
(someBooleanExpression) and: [someOtherBooleanExpression]
versus
[someBooleanExpression] and: (someOtherBooleanExpression)
versus
[someBooleanExpression] and: [someOtherBooleanExpression]

Sure, we can offer tool support to help in such situations. But the parser
is just too naggy. :-)

Best,
Marcel



--
View this message in context: http://forum.world.st/caseOf-otherwise-Parser-is-way-too-cautious-tp4897986.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list