[racket-dev] Typed versions of untyped collections

From: Neil Toronto (neil.toronto at gmail.com)
Date: Mon Dec 17 00:59:15 EST 2012

Changing the subject line for wider appeal.

On 12/16/2012 06:41 PM, Eli Barzilay wrote:
> 10 minutes ago, Neil Toronto wrote:
>> I think I'd rather have a convention in Typed Racket that (require foo)
>> imports `foo/typed' when it exists.
>
> +14.  I think it came up in the past, but I don't know why it wasn't
> done...

No consensus? That happens a lot.

>> Speaking of conventions, I see that none of the `typed/*'
>> collections are documented. It would be easy to get them at least
>> indexed by putting a `defmodule*/no-declare' after the `defmodule'
>> for the untyped module.  I wouldn't have known about
>> `typed/rackunit' without Jens Axel using it for his test cases. I
>> have no idea how he found out about it.
>
> Actually, if the above is implemented, then there's no need to
> document the `foo/typed' modules, instead, the docs for `foo' would
> mention that it has a typed version.

It's one more thing for people to look up or remember, both library 
developers and users. If it could be done in Typed Racket's `require' 
only once, it would save aggregate trouble.

Also, I'm eventually going to reimplement most of `plot' in TR. Then 
`plot/typed' would become redundant because it would just re-export 
`plot/main'. I'd rather be able to delete it. If I couldn't, after the 
documentation stops indexing `plot/typed', there would be programs out 
there that apparently refer to undocumented libraries. That, or the 
`plot' documentation would have to index `plot/typed', like, forever.

There are other ways to do it, of course. One is to have TR's `require' 
try importing a submodule called `typed' first. IOW, (require plot) in 
TR code means (require (submod plot typed)) when that submodule exists. 
Isn't that kind of thing what submodules are for?

Neil ⊥


Posted on the dev mailing list.