[racket-dev] typed/scheme n00b question

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Sep 5 10:41:01 EDT 2010

There are two views in the exception world: 

 -- annotate the return type with all possible exceptions 
	(Java does this and is the most popular language that does so)

 -- consider exception to be implicit effects 
	(ML created and pushed this variant for three decades)

PLT Scheme went with the second option (as an untyped language) from the beginning. Typed Racket {Scheme} mirrors this decision. 

Since the fail-thunk isn't expected to return anything, I would assume that (almost) all calls to file-or-directory-modify-seconds get away with 

 (-> Void)

as the type for the fail thunk. 

Other than that, the function can take 1, 2, or 3 arguments I would expect Sam to use some case-lambda type for the function overall. 

-- Matthias

On Sep 5, 2010, at 9:59 AM, Shriram Krishnamurthi wrote:

> Can you tell us (om the list) what the true type is?  I'm sure I'm not
> the only one curious as to precisely what it is and how you would
> write it w/ the exception.  Thanks.
> Shriram
> On Sun, Sep 5, 2010 at 8:57 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> On Sun, Sep 5, 2010 at 3:06 AM, Hari Prashanth <krhari at ccs.neu.edu> wrote:
>>> Is this what you are looking for?
>>> (require/typed racket/base
>>>               [
>>>                (String (Option Integer) (-> exn:fail:filesystem) -> (U Integer Void))])
>> Hari is correct that you can use `require/typed' on `racket/base'.
>> However, that type isn't quite right - it shouldn't *return*
>> `exn:fail:filesystem' - that is an exception that might be raised.
>> The true type is more complex; I'll add it to the base environment.
>> --
>> sam th
>> samth at ccs.neu.edu
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/dev
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

Posted on the dev mailing list.