Skip to end of metadata
Go to start of metadata

There are some issues with core.typed's current type syntax.

Special types

There are several special types that might be more useful as parameters to existing classes.

This would increase the consistency of types (less special cases) and better facilitate reuse of complicated types.

Functions

Currently FnIntersection is a special type. This has been carried over from Typed Racket.

Really this should live as a parameter to IFn.

Semantics

Currently FnIntersection basically works like IFn. Functions and things implementing IFn can be checked against an FnIntersection, although this is through a hack that replaces IFn and AFn ancestors with a FnIntersection.

A big problem with FnIntersection is that it doesn't play cleanly with deftype/defrecord extending to IFn.

Syntax

Practically, the Fn syntax will need to change. Unfortunately it uses the same name as clojure.lang.Fn, which is probably a useful class to use.

The vector syntax for a single function type is very convenient and not worth deprecating. Instead it should be equivalent to a single arity IFn.

IFn will probably take a parameter, which must be a subtype of FnIntersection.

Labels: