[racket] TR: unwrapping from <#Typed Value: ... > ??

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Nov 25 10:30:08 EST 2011

On Fri, Nov 25, 2011 at 9:13 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Fri, Nov 25, 2011 at 9:58 AM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
>> Why can't you use contracts to do this kind of thing?
> First, `cms->list' has to return a `(Listof Any)' because arbitrary
> code on the stack can add to the mark set.
> In the other direction, what would the contract on `w-c-m' be?  The
> second argument is an arbitrary value, so it's wrapped with the
> contract that's generated for `Any', which needs those `Typed Value'
> wrappers. Perhaps it could make use of some more type information at
> this point in special cases where that's available; I'll look into
> that.

Sorry-- I'm saying that you could let typed-racket programmers say
"This value (that I happened to just get out of cms->list) has type
'Integer -> Integer'." and use contracts to enforce that.

(I believe they can already do that if they make a new module that
contains an identity function with an appropriate type but providing
them a more convenient way to do it seems worthwhile for situations
like this.)

FWIW, working out a type system that could reason able the dynamic
context of a call to cms->list (and thus get more type information)
seems difficult. Perhaps this is one of those situations where
contracts are the right choice?


Posted on the users mailing list.