Re: Thoughts and proposals about types and classes

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Mon, 13 Sep 1993 09:38:27 -0400

On Sep 13, 11:51, Jack Jansen wrote:
>
> There's a serious flaw in the whole idea, though, that was pointed out
> by Dik Winter: the semantics are unclear. If I say "allowed(x+1)" it
> is clear enough (even though there are implementation difficulties, as
> Tim pointed out): check wether x has an add method that supports
> integer arguments. If I say "allowed(foo())" ditto, I think: check that
> foo is a function. If I say "allowed(foo()+1)" it becomes undecidable
> without calling foo, since foo might return a different type depending
> on the phase of the moon.
>

I think what you have stumbled across here, Jack, is the probability
that the sort of feature we've been talking about may only be able
to be implemented ( of if implemented, used ) in a limited fashion
in a dynamic/loosely typed O-O language. It might actually work in
a compiled, strongly-typed, type-inference class based type language,
where allowed( foo()+1 ) would most often turn into a compile time
consistency check, and only turn into a runtime test when there was
not enough context to determine what set of objects 'foo' could
possibly be bound to.

>
> Oh well, another interesting idea down the drain,

This is the 2nd time I've tried to recall a Cardelli paper
about the addition of type 'Dynamic' to Modula-3 : the
question came up in another forum about how much checking
was done at compile time and how much at run time.
( Dynamic was an attempt to add a dynamic run time typing
to a language that was strongly compile time typed in a
SAFE manner - i.e. without breaking all of the type
checking with the contagion of uncertainty. ) I know
Guido has stated that Modula-3 was one of the inspirations
for python - perhaps he will have some comment when he
get back.

- Steve M.