[racket] Plot is voracious

From: Neil Toronto (neil.toronto at gmail.com)
Date: Wed May 21 12:09:55 EDT 2014

Referencing an identifier before its definition raises an 
`exn:fail:contract:variable`. So that would put Plot in the weird 
position of having to distinguish different kinds of contract errors, 
but not by using subtypes or any other simple rule.

Maybe we should have an `exn:fail:contract:math` or 
`exn:fail:contract:domain` or `exn:fail:contract:argument` and make 
`exn:fail:contract:divide-by-zero` a subtype of it. I'd gladly change 
Plot to ignore just those, and change the math library to raise more 
specific errors.

(log 0) raises an `exn:fail:contract:divide-by-zero`, which is a 
terminology stretch that suggests we need a bit of refactoring anyway.

Neil ⊥

On 05/21/2014 09:51 AM, Robby Findler wrote:
> IMO, plot should raise that exception.
>
> Robby
>
> On Wed, May 21, 2014 at 10:37 AM, Laurent <laurent.orseau at gmail.com> wrote:
>> ... it eats everything! (particularly exceptions)
>> For example, it is perfectly happy with the following:
>>
>> % racket
>> Welcome to Racket v6.0.1.7.
>>> (require plot)
>>> (plot (function (lambda(x)(+ x n)))
>>    #:x-min 0 #:x-max 10 #:y-min 0 #:y-max 10)
>> (object:2d-plot-snip% ...)
>>
>> ... although n is clearly undefined. Presumably this is to avoid breaking on
>> math errors like `(/ 0)` ?
>>
>> Would it make sense to have an `exn:fail:arithmetic` exception struct so
>> that `function` would only catch those?
>>
>> Laurent
>>
>>
>> ____________________
>>    Racket Users list:
>>    http://lists.racket-lang.org/users
>>
> ____________________
>    Racket Users list:
>    http://lists.racket-lang.org/users
>


Posted on the users mailing list.