Re: [racket-dev] Is this a type error?

2012-10-23 Thread Danny Yoo
>>
>> (: 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.


There's some interaction with the structure in the union.  If I
simplify the type definition to:

(: current-defined-name (Parameterof (U Symbol)))

then the type system seems to be happy to accept 'unknown as an
acceptable symbol.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Is this a type error?

2012-10-23 Thread Neil Toronto

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 ⊥

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] Is this a type error?

2012-10-23 Thread Danny Yoo
On Tue, Oct 23, 2012 at 5:14 PM, Danny Yoo  wrote:
> The following program is generating a type error in 5.3.1, but I don't
> understand it yet.
>
> ;;;
> #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))



but I'd still like to know why the earlier code doesn't work in 5.3.1.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Is this a type error?

2012-10-23 Thread Danny Yoo
The following program is generating a type error in 5.3.1, but I don't
understand it yet.

;;;
#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))
;;;


I see the following error message:

. Type Checker: Expected (Parameterof (U Symbol
LamPositionalName)), but got (Parameterof (U Symbol LamPositionalName
'unknown)) in: (make-parameter (quote unknown))


which I didn't expect because 'unknown should be a symbol.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev