[plt-scheme] Case lambda in typed scheme

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Thu Mar 19 08:33:24 EDT 2009

On Thu, Mar 19, 2009 at 12:29 PM, Sam TH <samth at ccs.neu.edu> wrote:
> On Thu, Mar 19, 2009 at 8:09 AM, Paulo J. Matos <pocmatos at gmail.com> wrote:
>> I will file it as a bug but why do I need case-lambda: ?
>> I thought I would need it only if I didn't annotate the type of foo
>> function. But I do annotate it with
>>  (: foo (case-lambda [-> Symbol]
>>                    [Symbol -> Symbol]))
>>
>> the type of s is defined to be a symbol there... in the second line by
>> saying, Symbol -> Symbol, right?
>
> When you write:
>
> (: bar (Number -> Number))
> (define (bar x) (+ 1 x))
>
> Typed Scheme figures out from the type that `x' must have type Number.
>  But it doesn't do anything as sophisticated for `case-lambda', partly
> because `case-lambda' in types allows more things than can be written
> with `case-lambda' in expressions.  But it should do this, which is
> why it's a bug.

Ok, thanks for letting me know.
So, for case-lambda I guess I just use case-lambda: for now without
the need for the standalone annotation, right?

> --
> sam th
> samth at ccs.neu.edu
>



-- 
Paulo Jorge Matos - pocmatos at gmail.com
Webpage: http://www.personal.soton.ac.uk/pocm


Posted on the users mailing list.