-
-
Notifications
You must be signed in to change notification settings - Fork 37
Add argument checking for plot-area.
#91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Can't we just replace |
|
We could but the |
|
Is this something where it might be possible to make a program that depends
on racket/contract that is slower to compile than expected?
Robby
…On Fri, Apr 2, 2021 at 9:30 AM Sam Tobin-Hochstadt ***@***.***> wrote:
We could but the unsafe-provide was added because the generated contracts
are extremely expensive, especially in compile time.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#91 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADBNMEYNKCKHK6QGAPCNOLTGXIILANCNFSM42I5HDIQ>
.
|
|
I don't think this is a situation where |
|
HI @samth , thanks for the pull request, I will test it out later today. I will also need to fix @sorawee , with regards to the slowdown of the generated contracts, the slowdown was severe: at runtime, a plot in a GUI application would simply consume 100% CPU and be unresponsive, making the feature effectively useless. |
|
Hi @samth , this unfortunately does not fix the issue. Here is a simple program to reproduce the issue. You need to run it in DrRacket and move the mouse over the plot. Note that this will crash DrRacket. #lang racket
(require plot)
(define snip (plot-snip (function sin -5 5)))
(send snip set-mouse-event-callback
(lambda (snip x y event)
(send snip set-overlay-renderers #f)))
snipUnfortunately, adding argument checks to functions defined in TypedRacket and exported using
In this case, however, the problem is with the I will push a fix for this bug today. |
A `#f` value used to be converted to a list by `flatten` and passed to `plot-area`, since `plot-area` was exported using `unsafe-provide`, it had no further checks and crashed racket with an invalid memory reference. See also racket#91
|
What exactly has "too high price"? Couldn't we do something similar to
That way, |
|
Hi @sorawee , the steps you provided are indeed one way to deal with this problem, however:
Basically, doing what you suggest will address a minor issue, and I already have too many Racket related things to do and too little time to do them... |
|
Hi @sorawee , the general problem I was referring to is that Typed Racket incorrectly removes user code when "unsafe-provide" is used: #lang racket
(module a typed/racket
(require typed/racket/unsafe)
(unsafe-provide foo)
(: foo (-> Integer Integer))
(define (foo arg)
(when (integer? arg)
(printf "we just checked and arg is definitely an integer: ~a~%" arg)
arg)))
(require 'a)
(foo "I guess this is an integer")Which prints:
|
|
The actual problem was fixed in this commit 9189c8f |

Fixes racket/racket#3753.