[racket] Determining type from a syntax object

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Mon Jun 16 15:13:14 EDT 2014

On Mon, Jun 16, 2014 at 3:06 PM, Alexander D. Knauth
<alexander at knauth.org> wrote:
>
>> Typed Racket functions are
>> just plain Racket functions. We could add some extra metadata to every
>> value that held its type,
>
> It wouldn’t have to be every value, it could just put that information in for :has-type expressions, right?
> Would that still require fundamental changes to Racket?

The problem is that the information needs to get attached to the value
where the value is created, not where you use `:has-type?`.  The
`:has-type?` could even be in some other module, so you'd have to add
this information to every value, everywhere.  That's why it would need
to be part of the runtime.

>> and then implement this operation, but that
>> would require fundamental changes to Racket.
>>
>> Even if we wanted to do that, what if `f` came in from untyped Racket?
>
> If f comes from untyped Racket, then the type checker says to use require/typed to import it.

But what if it was imported with `require/typed` -- the value wouldn't
have the necessary runtime tags for determining if it has a particular
type.

Sam


Posted on the users mailing list.