[racket-dev] Machinery for eliding contracts

From: Neil Toronto (neil.toronto at gmail.com)
Date: Mon Jun 9 12:25:27 EDT 2014

On 06/09/2014 01:19 AM, Eric Dobson wrote:
>
> Does this seem like a reasonable thing to support/do people see issues with it?

I can only speak on reasonableness, and my answer is emphatically YES.

Typed Racket is a great language in which to define and use data 
structures: access is very fast, and many properties are checked 
statically. But accessor performance suffers badly when the data types 
are used in untyped Racket. If access uses higher-order functions (e.g. 
math/array), wrapping the functions slows access by a very high constant 
factor. If the data structures are first-order, every O(1) access 
becomes O(n).

I recently had to work around this in Plot when I needed an untyped 
module to be able to operate on typed BSP trees. I ended up making a 
typed weak hash map from "BSP tree handles" (gensyms) to BSP trees, and 
writing a new untyped API for operating on trees using handles. It was 
ugly. If the untyped and typed modules had been too tightly coupled, it 
would have been impossible.

IIUC, your proposal would make untyped use of typed data structures 
actually feasible for real-world use. So again, YES.

Neil ⊥


Posted on the dev mailing list.