[plt-scheme] Typed Scheme: Expected Number, but got Number

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Mon Jan 25 17:32:45 EST 2010

There are two problems here.

1. The error message shouldn't say "Number" in both places.  I can't
duplicate this behavior.  Can you tell me something more about how you
got this?

2. In the `typed-scheme' language `Number' == `Real', and
`string->number' produces `Complex'.  So this won't work.  If you
change the type annotation to `Complex', the program works.

This is because I made the terrible mistake of forgetting about
complex number originally.  There will soon be a new version of Typed
Scheme at `typed/scheme' and `typed/scheme/base' which fixes these
issues (and where your program will typecheck).

sam th

On Mon, Jan 25, 2010 at 5:08 PM, Noel Welsh <noelwelsh at gmail.com> wrote:
> Not sure what is going on here:
>
> Welcome to DrScheme, version 4.2.4.1-svn25jan2010 [3m].
>> (define: (foo (str : String)) : Number (let ([opcode (string->number str 16)]) (if opcode opcode (error "bum"))))
> . . Type Checker: Expected Number, but got Number in: (let ((opcode
> (string->number str 16))) (if opcode opcode (error "bum")))
>
>
> N.
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.