From: "Bob Hathaway" <objsys@netcom.com>
Subject: Re: SUMMARY: Object-Oriented Software Maintenance (1200 lines)
Date: Tue, 07 Apr 92 04:31:59 GMT
Organization: Object Systems

In article <BEVAN.92Apr3165546@panda.cs.man.ac.uk> bevan@cs.man.ac.uk (Stephen J Bevan) writes:
>In article <3rkjx-q.objsys@netcom.com> objsys@netcom.com (Bob Hathaway) writes:
>
>   ML is statically typed, so if I'm not mistaken, kiss
>   separate compilation goodby, they check everything.
>
>Why should static typing mean you can't have separate compilation?
>I thought most people considered C a (weakly) statically typed
>language, and it allows separate compilation.
>Haskell (a language I use more than ML) does the same sort of type
>recovery and static type analysis that ML does, and that allows
>separate compilation.  Am I missing the point here?  

But C isn't polymorphic like ML is.  Since ML supports polymorphism and
claims to be statically typed and since the versions of ML I used were
interpreted (nothing separate), I assumed all code would be available
allowing all functions to be checked with calls to insure type correctness.
Obviously they could use the same tricks we use in OO, I just assumed they
didn't.  With separate compilation and unrestricted polymorphic parameters,
how else do you invoke functions without dynamic typing or some efficiency
trick like C++'s virtual mechanism???  It has been a long time since I've
used ML, but the previous argument assumed ML could handle arbitrary
polymorphic parameters.  If its parameters are restricted, say to lists
or some special type, it isn't completely general (please forgive my loose
definitions).  Does ML and/or Haskell place restrictions on polymorphic
parameters, and if so, doesn't this make them weaker than dynamically bound
approaches?

>I am especially confused the following sentence :-
>
>   With Eiffel (C++, etc.) there is dynamic binding (which gives
>   separate compilation) but still with static typing.
>
>Maybe I don't understand what "separate compilation" means here.  I
>thought it meant that files could be compiled separately, but I can't
>reconcile that with the above statements.
>
These (although I'm assuming Eiffel uses the same virtual trick as C++)
languages resolve the separate compilation/polymorphism issue with
dynamic binding.  Without separate compilation, I'm not sure if any
dynamics are required at all.

>
>   Smalltalk is an extreme example the other way with no static typing
>   (hence a typeless language) 
>
>Lumping "dynamic typing" in with "weak typing"/"typless" means you
>have no way to distinguish between a language like Smalltalk in which
>the types can always be determined at runtime and languages like Forth
>where they cannot (unless you do it manually).  Now if you never care
>about this distinction, then fine, but to me it seems like a gross
>generalisation.

Maybe, I was just reusing common terms found in the literature without
regards to semantic content, my apologies.  I meant that is the reason
it is referred to that way, not to infer that it is a good reason.

>
>Also, there seems to be a terminology problem with a number of the
>latest OO books (e.g. Booch, Budd, Rumgaugh) as they all use terms
>like "static"/"dynamic" typing in subtly different ways, and
>consequently class various languages differently.  Whilst I don't
>claim to have the perfect answer, I would claim that the distinctions
>I make lead to a better classification.
>
Dynamic typing means performing typechecking at run-time (hence dynamically)
while static typing means performing typchecking at compile-time.  C++ is
statically typed because no type information is available to or can be used
by a running program (or even to a theoretical meta-level) but uses
'dynamic binding' to perform inclusion polymorphism by filling in function
pointers, where dynamic binding means that a compiled class may not know
all functions/methods that will be invoked from within its methods code,
although in statically typed languages these *methods* will be known to the
completely compiled program, but this is not necessarily true in dynamically
typed languages.  I'm not sure if any other definitions are appropriate.

bob
objsys@netcom.com

P.S.  My first two free working minutes will go to your functional
      transliteration.
P.P.S.  Time doesn't always allow me to be a daily reader, so please excuse
        any short term absences.
Newsgroups: comp.object