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

roughnum comparison needs improvement

Open shriram opened this issue 9 years ago • 6 comments

If you compare two roughnums for equality, you get a somewhat useful error: it tells you to use within. Unfortunately, because we don't yet have links to function documentation, it's not actually clear how to use within.

I propose that the "More" text for this error give a concrete example. Furthermore, once we add a ternary roughnum comparator (https://github.com/brownplt/pyret-lang/issues/780), the error message should recommend using that operator for equality comparisons and within for testing, and give concrete examples of both.

shriram avatar Jul 27 '16 00:07 shriram

Can you give a concrete message you'd like to see? My initial attempts at wording such a message choked on my own "too many words!" threshold, so they certainly wouldn't pass yours :)

blerner avatar Aug 06 '18 15:08 blerner

I don't suppose it's possible to add docs links? That's the real solution to this problem!

shriram avatar Aug 06 '18 16:08 shriram

That's a non-trivial design problem too. Pyret documentation links aren't stable (especially if we're revising the organization of the docs every so often); there's no representation of links in the error-rendering DSL; there are non-trivial typographic issues too (especially since you probably want to highlight the within code as being the main link text). So my question remains, can you give a concrete message you'd like to see?

blerner avatar Aug 06 '18 16:08 blerner

I think the error message is fine for now. Let's see if it comes up in a context where it's irksome.

shriram avatar Aug 06 '18 17:08 shriram

@shriram @blerner has such a context arisen in the last 2 years?

schanzer avatar Aug 12 '20 17:08 schanzer

I would like our errors to be nicer, and to have a good way of linking to docs. I can't spend too much time thinking about this today, but some quick brainstorms:

  • add a doc-link form to our ErrorDisplay construction
  • to allow docs to be flexible, I think we need an indirection layer here between the links and the docs themselves: possibly we create a docs page pyret.org/docs/latest/feedback-messages.html#message=<err-constructor-name>, and then the contents of that page describe each of the kinds of feedback message students can see, possibly with a link See .... And we can rig some JS in that page, perhaps, so that if you load the page with an anchor as above, and that anchor matches somewhere in the page, it immediately redirects to that followup link. This would decouple docs from the compiler itself...

blerner avatar Aug 12 '20 17:08 blerner