pyret-lang
pyret-lang copied to clipboard
roughnum comparison needs improvement
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.
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 :)
I don't suppose it's possible to add docs links? That's the real solution to this problem!
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?
I think the error message is fine for now. Let's see if it comes up in a context where it's irksome.
@shriram @blerner has such a context arisen in the last 2 years?
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-linkform to ourErrorDisplayconstruction - 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 linkSee .... 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...