[racket-dev] Typed versions of untyped collections
On 12/17/2012 02:44 PM, Matthias Felleisen wrote:
>
> My understanding is that
>
> -- Neil created a single file P, I believe it is typed
> -- he tells you to load plot/typed/ for the typed version
> -- he tells you to load plot/ for the untyped version
>
> Somewhere in this arrangement a call in some untyped client to a
> function f from P will cross a line.
>
> If this is wrong, I'd like to know where it goes wrong.
You're thinking of `math/array', which is written in Typed Racket. There
*is* a big performance problem with arrays in untyped code, because
arrays are basically higher-order functions. Getting elements from
arrays that cross the contract barrier is expensive.
`plot' is written in untyped Racket. There's no performance problem with
typed plots at all; in fact, using `plot/typed' from TR code ends up
checking exactly the same contracts for the same plots. `plot/typed' is
just another end-user that happens to re-export everything with types
attached.
> I like the submodule idea a lot.
Cool. I'd like to know how much work it would take to implement it.
Neil ⊥