[Types-sig] RFC 0.1

Tim Peters tim_one@email.msn.com
Thu, 16 Dec 1999 20:17:12 -0500

> Agreed.  List of integer and its friends are important.  Also
> correspondences (see my example of a sum() function taking a
> list of <something> and an additional single <something>.

Assuming an object of type C is declared

    decl x: C

and an object of type "list of C" is declared

    decl y: [C]

then for a function taking a list of some type and a scalar of that type,
returning a binary tree of objects of that type <wink>, I'd suggest:

    decl sum: def([_T], _T) -> BinaryTree(_T)

I'm just warping Haskell's system to Python conventions.  As I've noted
before, Haskell is the most Pythonic of all the languages that are entirely
unlike Python <0.9 wink>.

Correspondences require a formal type *variable*.  C++ templates use an ugly
angle-bracket notation to surround the formal type variables.  Haskell uses
identifiers that begin with a lowercase letter, conventionally a one-letter
name from the end of the alphabet.  I suggest a leading underscore in
Python, to suggest that there's something special about the name, and to
suggest that it's "local" to the type expression in which it appears.

it's-easy-if-you-don't-think<wink>-ly y'rs  - tim