[racket-dev] Is this a type error?

From: Neil Toronto (neil.toronto at gmail.com)
Date: Tue Oct 23 20:19:56 EDT 2012

On 10/23/2012 05:19 PM, Danny Yoo wrote:
>> #lang typed/racket/base
>>
>> ;; We may have more information about the lambda's name.  This will show it.
>> (define-struct: LamPositionalName ([name : Symbol]
>>                                     [path : String]    ;; the source of the name
>>                                     [line : Natural]
>>                                     [column : Natural]
>>                                     [offset : Natural]
>>                                     [span : Natural]) #:transparent)
>>
>>
>> (: current-defined-name (Parameterof (U Symbol LamPositionalName)))
>> (define current-defined-name (make-parameter 'unknown))
>
> To add, I can work around this behavior by doing:
>
> (: UNKNOWN Symbol)
> (define UNKNOWN 'unknown)
>
> (: current-defined-name (Parameterof (U Symbol False LamPositionalName)))
> (define current-defined-name (make-parameter UNKNOWN))

That looks to me like a problem with the inferencer. It's *something* 
with the inferencer, because you can work around it by annotating:

   (: current-defined-name (Parameterof (U Symbol LamPositionalName)))
   (define current-defined-name (make-parameter (ann 'unknown Symbol)))

I just don't know whether it's technically an error in TR.

Neil ⊥


Posted on the dev mailing list.