OOP
Arthur Gold
agold@bga.com
Wed, 12 Nov 1997 14:16:48 -0600
"Robert A. Abernathy" <raa@hybrithms.com> wrote:
>I have a request. If any of the proposed object oriented
>extensions to Clean are put in place, could the name be changed
>from Clean to Muddy.
>
>Hybrid OOP languages are ugly beasts. A Clean like OOP
>language could well be a neat thing, but I think it would
>be better to start with the Clean intermediate language
>and build a new pure OO-functional language on top of this
>base.
>
>Rob
You have a point. Attempting to add 'purely-OO' (in the sense of CLOS or
Smalltalk) to a staticly-typed language like Clean, would certainly
'muddy-up' the waters. There's another option, however, that would give the
desired effect: i.e. the addition of typeclass-restricted dynamic types.
Consider the following proposed syntax (roughly along the lines of
existential types)
::ADynamicType = Dyn.a: SomeClass a
which would be roughly equivalent to defining all of the following:
::ADynamicType a = ADynamicType_Type1 a
| ADynamicType_Type2 a
| ...
| ADynamicType_TypeN a
class ToADynamicType a | SomeClass a
where
toADynamic::a->ADynamicType a
toADynamic::Type1->ADynamicType
toADynamic a = ADynamicType_Type1 a
...
toADynamic::TypeN->ADynamicType
toDynamic a = ADynamicType_TypeN a
instance SomeClass ADynamicType
where
f1 (ADynamicType_Type1 x) = f1 x
f1 (ADynamicType_Type2 x) = f1 x
...
f1 (ADynamicType_TypeN x) = f1 x
f2 (ADynamicType_Type1 x) = f2 x
...
f2 (ADynamicType_TypeN x) = f2 x
...
fN (ADynamicType_Type1 x) = fN x
...
fN (ADynamicType_TypeN x) = fN x
(f1 .. fN are the functions that are members of SomeClass)
Of course, some additional plumbing may be required; in particular, the
results of the various would probably have to be wrapped up in some sort of
dynamic type as well...
Anyway, just a thought.
--Artie
Arthur Gold Austin, Texas
** artiegold@weirdness.com agold@cs.utexas.edu **
"`Go to' considered harmful" -- E. Dijkstra
"Go to, go to!" -- W. Shakespeare (Hamlet Act I. Sc. III L. 118)