[Types-sig] feedback: PyDL RFC 0.4
Paul Prescod
paul@prescod.net
Mon, 03 Jan 2000 23:41:55 -0500
Tony Lownds wrote:
>
> Why not allow a default type to a parameterized interface?
>
> class (T:=Any) Set:
> ...
>
> decl f as def(x: Set)
> decl g as def(x: Set(Int))
Why ":=" and not just "="?
> Paul, is it your intention that...
> a tuple is a Sequence?
> a list can be a Record?
>
> I hope so, I think these syntactic shortcuts will be good if so.
Yes, and yes. You could also define your own record types.
> Can one declare a Mapping of more than one pair of types?
> ie, {T1: T2, T3: T4}
Is this close enough:
{T1 or T3: T2 or T4}
I think that's closer to the mathematical concepts of domain and range.
> You dont show a way to specify default arguments. How about:
>
> def(Arg1: String, Arg2: String = optional) -> Int
Here are other ideas:
def(Arg1: String, Arg2: String?) -> Int
def(Arg1: String, [Arg2: String]) -> Int
Paul Prescod