[racket-dev] Typed versions of untyped collections

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Thu Dec 20 10:55:03 EST 2012

On Mon, Dec 17, 2012 at 4:09 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Mon, 17 Dec 2012 15:51:38 -0500, Sam Tobin-Hochstadt wrote:
>> On Mon, Dec 17, 2012 at 3:27 PM, Robby Findler
>> <robby at eecs.northwestern.edu> wrote:
>> > I've long thought something along these lines is a good idea, but perhaps
>> > what I think is a good idea isn't what Matthias and Sam think is the bad
>> > idea.
>> >
>> > I think that it makes sense for 'require' in typed-racket to look in a
>> > different place than 'require' in untyped racket looks so that one can write
>> > the same require spec (in both the docs and the code) and have two versions
>> > of the same library, one that is typed and one that isn't typed. Then, then
>> > library writer, if they choose, can decide who pays what for going (or not)
>> > across the boundary between typed and untyped. (Or maybe submodules would be
>> > better.)
>>
>> I think this is exactly what Eli was suggesting, and what I think is a bad idea.
>>
>> > I think this is already happening in TR anyways, when I write
>> >
>> >   (require racket/list)
>> >
>> > I don't get the same file being loaded when that is in a TR program as when
>> > it is in a R program.
>>
>> You get *exactly* the same file as in R.  I think that (a) this is a
>> valuable invariant and (b) the mechanisms for violating this invariant
>> are all very worrying.
>
> FWIW, our current module-loading infrastructure is better adapted to a
> search for `(submod typed racket/list)' in place of `racket/list',
> instead of `racket/list/typed'. That is, submodule paths are intended
> to play nicer with a search, and that intent is encoded in rules for
> layers of module and load handlers.

Can you expand a little on what you mean here?  Imagine that I have a
module in Typed Racket, written as:

#lang typed/racket
(require A B)

where `(submod typed A)` exists, but `(submod typed B)` doesn't exist,
and so just plain `B` should be required, meaning the module should
really be expanded as if it was:

#lang typed/racket
(require (submod typed A) B)

What would Typed Racket need to do here to make this work sensibly?

Sam

Posted on the dev mailing list.