[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Context in data decl
From: fplangc-request@cs.ucl.ac.uk
Date: 15 Feb 91 5:57
Sender: Joe Fasel <jhf@chaco.c3.lanl.gov>
To: fplangc@cs.ucl.ac.uk, peterson-john@cs.yale.edu
Subject: Re: Context in data decl
I agree with Lennart's observations about why we should want to
keep contexts for data declarations: that the abstract data type
solution doesn't allow pattern matching, and the "Hello" :+ "World"
problem.
I was mystified by John Peterson's statement that niladic constructors
of data types with contexts are a typing problem, until he
explained that the problem is with the single-overloading rule.
As he said,
data (Eq a) => Foo a = C1 a | C2
is problematical, because
x = C2
runs afoul of the single-overloading rule. Actually, so does
f = C1
although this can be fixed:
f x = C1 x
Essentially, the constructors of a type like Foo are overloaded constants.
So, here is another case in which the single-overloading rule is
an annoyance. I suggest that we keep contexts for data declarations
and nuke the single-overloading rule.
I'll say more about this tomorrow. Right now, I've gotta go crash.
--Joe