[racket-dev] Typed Racket and importing polymorphic code

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Mon Aug 2 09:58:57 EDT 2010

I'm glad this is considered a bug.

>> 1'. That seems unlikely given that if I instead add "insert" to the
>> above (#lang racket) source file and run Check Syntax, I get the same
>> error -- so it is indeed a static error.  (Well, maybe not "static",
>> there are probably three or four "times" at work here.)
>
> This is a different issue - it shouldn't work to use `insert' in an
> untyped context, since there's no way to generate a contract for its
> type.  This is also what's happening with the REPL, but that shouldn't
> be treated as a untyped context (that's the bug).

I don't understand why this is a "different issue".  The Check Syntax
behavior looks just right to me.  I don't see an "issue" at all.

Did you mean that the REPL *should* (not "shouldn't") be treated as an
untyped context?

>> 2. Why does the same not happen with map?  I can use map freely; if I
>> put it in the #lang racket file and Check Syntax, it draws an arrow
>> from map to the required (typed) file.  Yet in the typed file:
>
> `insert' is defined in typed code, and `map' is not.

Depends on how you want to define the term.  I imported a language
with map and explicitly provided it.  BUT:

That's beside the point.  map has just as much a polymorphic type as
insert.  You said earlier, "it shouldn't work to use `insert' in an
untyped context, since there's no way to generate a contract for its
type".  Why does this statement not apply to map?

Shriram


Posted on the dev mailing list.