On 05/28/2015 09:12 AM, Neil Toronto wrote:
On 05/27/2015 11:43 PM, Neil Toronto wrote:
On 05/22/2015 04:16 PM, Ryan Culpepper wrote:
* Neil Toronto <[email protected]>
- Plot Tests
- Images Tests
- Inspect icons
- Math tests
Status: Working on Doug's animation test case for Plot. It's very slow.
It looks like it has to do with a dc<%> instance crossing from untyped
to typed code. I'll probably end up inserting the types of `plot/dc` and
`plot3d/dc` into the base type environment, and then finding some way to
put contracts on them.
I need some help with this.
My typical workaround for acute contract slowness is inserting types
into the type environment. But that only works around contracts
introduced by `require/typed`. I forgot last night that `plot/dc` and
`plot3d/dc` are written in Typed Racket.
What I'd like - and what I can't figure out - is a way to simulate the
behavior of `provide/unsafe` in Racket 6.2.
The `plot/dc` and `plot3d/dc` functions have types that look like
(-> ... (Instance DC<%>) ... Void)
If an (Instance DC<%>) value is passed from untyped Racket to one of
these functions, it gets wrapped with a contract that makes drawing very
slow.
It wouldn't help to provide different implementations of `plot/dc` and
`plot3d/dc` to untyped code. All plot drawing is done in Typed Racket,
so at *some* point, the (Instance DC<%>) has to pass from untyped to typed.
Any ideas?
Attached is one way of exporting unchecked bindings from Typed Racket
using a compile-time helper module.
Ryan
--
You received this message because you are subscribed to the Google Groups "Racket
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-dev/55671B37.3080904%40ccs.neu.edu.
For more options, visit https://groups.google.com/d/optout.
#lang racket/base
(provide (all-defined-out))
;; Once "typed.rkt" is visited, the-f-box holds a reference to the
;; internal (uncontracted) version of f.
(define the-f-box (box #f))
#lang typed/racket/base
(require (for-syntax racket/base "ct-helper.rkt"))
(provide f)
(: f : Integer -> Integer)
(define (f x) (+ x 1))
(begin-for-syntax
(set-box! the-f-box #'f))
#lang racket/base
(require (rename-in "typed.rkt" [f safe-f])
(for-syntax racket/base "ct-helper.rkt"))
(define-syntax unsafe-f
(make-rename-transformer (unbox the-f-box)))
(safe-f 1)
(with-handlers ([exn:fail? (lambda (e) "error, as expected")])
(safe-f 1.2))
(unsafe-f 1)
(unsafe-f 1.2)