[racket] typed racket: how to define a binding as both a runtime var and a type?

From: Alexander D. Knauth (alexander at knauth.org)
Date: Sun Feb 22 19:47:27 EST 2015

Normally I would do that and capitalize the first character of the type, but I am trying to define values and types for the chemical elements, and those are capitalized already.  

On Feb 22, 2015, at 3:01 PM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:

> 
> Why do you want that? It's confusing to write x : x. I'd prefer x : X anyways. 
> 
> 
> On Feb 22, 2015, at 2:43 PM, Alexander D. Knauth wrote:
> 
>> Using #:omit-define-syntaxes doesn’t work because then when other modules import it it forgets about the type:
>> 
>> def.rkt:
>> #lang typed/racket
>> (provide x)
>> (define-type x 'x #:omit-define-syntaxes)
>> (define x : x 'x)
>> 
>> ref.rkt:
>> #lang typed/racket
>> (require "def.rkt")
>> x ; works fine, outputs 'x
>> (define y : x x) ; Type Checker: parse error in type; type name `x' is unbound in: x
>> 
>> Why doesn’t this work, and is there another way to do this?
>> 
>> 
>> 
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
> 



Posted on the users mailing list.