[plt-dev] Typed Scheme: function type declarations should support optional args

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Mar 31 08:04:49 EDT 2010

On Mon, Mar 29, 2010 at 4:06 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> If you're hacking on the internals of TS, there's a convenience
> function for doing that. Look for `->opt'.

Ta. (That was just the ugliest example I have.)

> I'll try to do this in the reasonably near future.  Suggestions for
> syntax?  Note that it has to be work with the eventual addition of
> possibly-optional keyword arguments.

Would not imitating the existing function defn syntax be sufficient?:

(: foo (A [B] [C] -> D))

B and C are optional in this type definition. This extends to either

(: foo (A [B] #:c [C] -> D))  ;; consistent with define


(: foo (A [B] [#:c C] -> D))

for optional keyword args and

(: foo (A [B] #:c C -> D))

for required keyword args.

> I don't know what you mean here.  `define' and `lambda' in Typed
> Scheme are the ones that don't support keyword or optional arguments,
> as they are in the `mzscheme' language.  Typed Scheme does not
> implement a separate `define'.

Ok, that answers my question.


Posted on the dev mailing list.