[Types-sig] List of FOO

Greg Stein gstein@lyra.org
Wed, 15 Dec 1999 03:33:46 -0800 (PST)


On Tue, 14 Dec 1999, Paul Prescod wrote:
> Martijn Faassen wrote:
... example ...
> 1. This system is supposed to be extensible, right? So I could, for
> instance, define a binary tree module and have "binary trees of ints"
> and "binary trees of strings." How do I define the binary tree class and
> state that it is parameterizable?

Dunno. I'll leave that for some other brainiac. :-)

As Tim pointed out: you'll get 99% of your benefit from handling a
half-dozen builtin types and their composites.

Lessee... int, long, float, complex, list, dict, tuple, func, class

2nd order: numeric, sequence, mapping

I think a big question is whether you provide syntax, like what Tim just
posted recently (e.g. ["" -> 0] -> None), and/or whether you use/allow
names (which refer to Types) (e.g. [StringType -> IntType] -> None). If
you allow names, rather than pure syntax, then the compiler will need to
infer what type the name refers to.

Note that the presence of classes means that names are probably required
in some way.

> 2. How does this work with interfaces? "ListType" is cheating. We need
> SequenceType because that's not implementation specific. And
> SequenceType needs to be defined by an interface, not a class.

We need both. It is perfectly acceptable to state that a List is required.

> 3. What does "tuple of int, string" look like? And should we have list
> length parameters?

I think Martijn answered this one.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/