racket / redex

Other
93 stars 36 forks source link

Clarify error message when expression isn't in reduction relation's domain #220

Closed jsjolen closed 3 years ago

jsjolen commented 4 years ago

Short description Change "relation not defined for ~s" to "~s is outside of the reduction relation's domain" at this line.

Long description

A reduction relation is applied (through apply-reduction-relation for example) to a term which isn't in its domain gives an unnecessarily non-descriptive error.

The current error message is "relation not defined for ~s"

I propose that the error message is changed to something that mentions that the expression is outside of the domain of the reduction relation.

This would be similar to the error message given when a metafunction is applied to something outside of its domain ("... is not in my domain") and when a relation is reduced to something outside of its co/domain (""relation reduced to ~s via ~a, which is outside its ~a"").

It would be a small change and probably backwards compatible (surely Redex doesn't guarantee that error messages stay the same?).

I can make a pull request for this change, it'd only require changing this line.

bennn commented 4 years ago

+1 for adding "domain" to the error message

I'd use raise-arguments-error to create/format the message. That'll also limit the size if the bad term happens to be very long.

jsjolen commented 3 years ago

@rfindler, I read your commits fixing this, thank you for your hard work!