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

Request to augment error wording when "is" omitted

Open kfisler opened this issue 9 years ago • 10 comments

We just had someone write (effectively)

examples: the-fun(5) 5 + 10 end

The error reasonably flagged that it looked like the person was writing tests, but this wasn't a "testing expression". The error might be more useful if it reminded someone that a "testing expression" has "is" between the expression to check and its expansion.

Note that "is" is particularly easy to miss in Bootstrap, because our paper worksheets pre-print the "is" keyword Users don't write it manually, so they aren't as conscious of needing it.

Unless there is a subtlety with this error, it would be nice to hint at "is" in the text of this message.

kfisler avatar Jul 18 '16 19:07 kfisler

It would be easy to add a sentence, "Testing statements are typically of the form actual is expected", except of course that this statement is somewhat inaccurate/misleading since there are lots more testing forms than just is. Is there a decent phrasing you could suggest that wouldn't be misleading once students are introduced to the rest of Pyret's testing forms?

Note that this situation produced two errors, one on each of the lines, complaining that neither of them was a testing statement. It will be hard to reliably detect situations like this and suggest "Were you missing is between these two?", so I want to discard that as a potential improvement on the message. (We could do it heuristically, but if there are an odd number of statements, which should we pair up and which do we leave alone?)

blerner avatar Jul 18 '16 21:07 blerner

Yes, but I think we can safely say something of the form ​"usually has an is" and that would be all we need. For those who don't know better, they will say "Aha, I'm missing an is". For those who do, they'll know that the "usually" is saying "but there can be other possibilities".

Linking to — even better, having a pop-up of — the corresponding grammar and docs could be very handy.

Overall, I'd want to see some text like

A test consists of an expression followed by an answer connected by a word, usually is. Pyret is unable to find …

Shriram

shriram avatar Jul 19 '16 06:07 shriram

Poking on this issue, because (1) it definitely comes up in Bootstrap, (2) Shriram's proposal does seem to catch the common cases, and (3) as he points out, the uncommon cases are likely caused by savvier users who will figure out the problem even if the error itself is slightly misleading.

schanzer avatar Aug 12 '20 17:08 schanzer

Is this wording acceptable? image

blerner avatar Aug 12 '20 17:08 blerner

Absolutely.

If I had my druthers, I’d like a more descriptive term than “word“. Even “keyword“ would be an improvement. But this is definitely important enough that I’ll take sub optimal wording today over perfect wording at some unknown point in the future!

schanzer avatar Aug 12 '20 19:08 schanzer

easy enough to write "answer connected by a testing keyword, usually is"

blerner avatar Aug 12 '20 19:08 blerner

A test consists of an expression followed by an answer connected by a word, usually is.

does-not-raise doesn't fit to the above description.

I personally think the following is better:

A test should be in a form like:

  • some concrete example, like 1 + 2 is 3
  • some concrete example, like [list: 1, 2, 3].length() does-not-raise
  • some concrete example

sorawee avatar Aug 12 '20 19:08 sorawee

As Shriram said above, "For those who do, they'll know that the "usually" is saying "but there can be other possibilities"." I think your wording here is going to be much too long for anyone to read through...

blerner avatar Aug 12 '20 20:08 blerner

Well, in that sentence, "usually" applies to is, not "A test consists of an expression followed by an answer connected by a word".

But this is easy to fix. Just move "usually" to the first sentence.

sorawee avatar Aug 12 '20 20:08 sorawee

Your point is well taken, but that's still not enough -- a test can have a because clause, a refinement predicate, ... the grammar is quite rich :) For someone making a very novice mistake here, Shriram's point is to tell them the barest minimum of things to try; anyone else will be easily able to recognize their mistake.

blerner avatar Aug 12 '20 20:08 blerner