My paragraph after that was ~= I don't understand the need to do
anything with a exn:fail:contract except show the user and exit.

IIUC that's already the default behavior for non-GUI Racket apps, when
some code is being hopeless.

1. Some other codes notices and raises exn:fail:contract.
2. The uncaught exception handler displays the details.
3. The app exits -- before it can do any more harm.

Can we agree that 2 and 3 is the best (or anyway least-worst) thing to
do?  That normally, no good step 4 exists?

If not: No worries, I won't try to convince you here.

If so: There might be conditions where 2 and 3 aren't happening at
all, or well-enough. We could dig into that.  (Maybe there aren't
enough details for a good "crash report". Maybe a handler somewhere is
eating exns. Maybe a GUI app, when run outside DrRacket, the user
doesn't necessarily see the message (??). And so on.)

On Mon, Mar 25, 2019 at 12:00 PM James Platt <j...@biomantica.com> wrote:
>
>
> On Mar 23, 2019, at 5:49 PM, Greg Hendershott wrote:
>
> > But -- contract violations aren't like that. They're about some code
> > surprising some other code. I think the only hope here is, run the
> > code enough (before the user ever does) to flush out the bad code
> > assumptions and fix them. Realistically that means having enough
> > automated tests, and running them frequently enough (like on every
> > code commit, or at least push, and you can't merge to master if tests
> > don't pass, etc.).
>
> Yes, but contract violations are also, by definition, problems that have been 
> anticipated.  You may not know why a function is, for example, being passed a 
> specific parameter that is the wrong data type or is empty when you said it 
> should be non-empty but you do know that that is what happened.  It's enough 
> to go on for an error message.  My hope was that contracts would provide a 
> more granular set of predicates to test for each of the possible violations.
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to