pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

change wording of error message

Open shriram opened this issue 7 years ago • 4 comments

When a body contains multiple expressions, the error reads

Either simplify this block to a single expression, or mark the outer expression with block: to indicate this is deliberate.

I don't like the use of simplify. In fact, there's a good chance they'll need to "complexify" the code to keep and then combine the multiple expressions. I would indeed remove a verb entirely: we shouldn't tell them what to do, we should just tell them what the result should be (in the former case).

Note that a 019 student just read this as "Pyret is asking me to use block" (emphasis mine).

shriram avatar Sep 10 '18 11:09 shriram

Could you suggest a complete wording of the message that you would like to see? Given that many of our messages do display a suggested course of repair, what should we say here?

blerner avatar Jul 17 '19 22:07 blerner

About to hit the road, so I'm going to ask @jswrenn to take a first stab at proposing an alternative (since he's also the moral arbiter of messages).

shriram avatar Jul 17 '19 23:07 shriram

Maybe I'm misunderstanding, but I thought this attempt to recreate Shriram's issue should generate the error:

fun f(x):
  a = 4
  r = 5
  x
end

Shouldn't this need a block?

schanzer avatar Sep 11 '25 16:09 schanzer

a = 4 is a statement, not an expression. Needs to be two expressions that evaluate to a value, like

fun(x):
  x + 1
  x + 2
end

(Which is likely an error)

jpolitz avatar Sep 11 '25 16:09 jpolitz