On Sun, Jan 6, 2013 at 3:13 PM, Robby Findler
<ro...@eecs.northwestern.edu> wrote:
> I wouldn't say you'd do it for cons cells (they are special in the runtime).
> This is for structs that are declared in TR. You would add the field
> everywhere (or places where the programmer asks only).

Right, I know how the real Racket `cons` is implemented, that's just a
simple example.  Imagine if `cons` was a TR data structure.

> The boundaries have the information; that's how the contracts got inserted
> in the first place.

No, the contracts are parametric contracts using `parametric->/c`, and
thus don't have any information about the types used at all.

Sam

>
> Robby
>
>
> On Sun, Jan 6, 2013 at 2:03 PM, Sam Tobin-Hochstadt <sa...@ccs.neu.edu>
> wrote:
>>
>> On Sun, Jan 6, 2013 at 2:55 PM, Robby Findler
>> <ro...@eecs.northwestern.edu> wrote:
>> > What if you added an extra field to immutable values (ie all TR structs
>> > would have this hidden field) such that, when they passed across a
>> > boundary,
>> > the field got mutated to say what type it passed at. Then, when the
>> > value
>> > passed back into TR, TR could check to see if has this secret field and
>> > what
>> > the type was and then avoid more checking.
>>
>> The problem is that this info isn't available anywhere (and I'm not
>> sure it's really sensible).  Consider the `cons` function (on lists
>> only).  If you write `(cons 'hello empty)` in untyped code, what type
>> should get inserted, and where should that be calculated?  This
>> calculation can't really be done both automatically and correctly
>> ahead of time, and would add a bunch more expense.
>>
>> Sam
>
>
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Reply via email to