Article View: comp.lang.misc
Article #4630OBJ2 and Smalltalk
From: rentsch
Date: Fri, 30 Jan 1987 05:15
Date: Fri, 30 Jan 1987 05:15
131 lines
5925 bytes
5925 bytes
In article <4196@utah-cs.UUCP> shebs@utah-cs.UUCP (Stanley Shebs) writes:
> [aren't you glad I didn't include the article?]
Because my opposite seems more interested in scoring debate points
than shedding light on the subject, I have taken the time to read
the OBJ2 paper ["Principles of OBJ2", 12th POPL, January 1985,
pp52-66]. I will here try to answer some the relevant questions
about OBJ2 and Smalltalk.
Before we begin, let us be clear on what is being discussed. The
issue is how are OBJ2 and Smalltalk different (or similar). Please
note that the issue is NOT either (1) which is better, or (2) which
is more (or less) representative of its respective methodology (ADT
for OBJ2, OOP for Smalltalk). If someone is interested in
discussing these issues, fine, except that arguing in response to
this posting is not the right way to do that. [There are some
excerpts which might be construed as making points on issue (2).
Those excerpts were not included for that reason, I assure you.]
For reference: text in double quotes is an excerpt from the OBJ2
paper. Questions in single quotes are my own, to be asked of both
languages, with my answers provided. The neutral term 'type' is
used instead of 'sort' in the case of OBJ2, 'class' in the case of
Smalltalk. The term 'type-specification' is used for text
associated with variable declarations which allows type checking.
The answers in the OBJ2 case are my best understanding based on my
reading of the OBJ2 paper; however, there is no guarantee that those
answers are correct. Factual corrections (arguments are not
necessary, but give reasons, please!) are appreciated.
The answers in the Smalltalk case are based on my experience with
several Smalltalk system.
So, onward!
Q: 'Do variables have type-specifications?'
OBJ2: yes. Smalltalk: no.
Q: 'Can the value of a variable be an object of any type at any time?'
OBJ2: no. Smalltalk: yes.
Q: 'Is inheritance supported?'
OBJ2: yes. Smalltalk: yes.
Q: 'Is multiple inheritance supported?'
OBJ2: yes. "Multiple inheritance in the sense of object-oriented
programming permits one sort to be a subsort of two (or more)
others ..."
Smalltalk: kind of. (There is a supplied multiple inheritance
mechanism, but none of the standard system code uses it. I have
never used it myself, nor have I seen any examples of its use;
but I believe there are some.)
Q: 'Is the language type checked? (i.e., when the source code is
read, not at run time)'
OBJ2: yes. Smalltalk: no.
Q: 'Is the language strongly typed?'
OBJ2: yes. Smalltalk: no.
"OBJ2 is strongly typed."
Q: 'Can polymorphic procedures be written?'
OBJ2: yes. Smalltalk: yes.
Q: 'Can polymorphic procedures be written without subtypes and
without parameterized types?'
OBJ2: no.
Smalltalk: yes. (Note also the question following.)
Q: 'Does the language have parameterized types?'
OBJ2: yes. Smalltalk: no.
Q: 'Can Stack( arbitrary type ) be written?'
OBJ2: yes, using parameterized types. Smalltalk: yes.
Q: 'Can Stack( mixed types ) be written, without using either
subtypes or parameterized types?'
OBJ2: no. Smalltalk: yes.
Q: 'Are procedure calls checked against their specifications (i.e.,
when the source code is read, not at run time)?'
OBJ2: yes, type checking. Smalltalk: no.
Q: 'What are the formal theoretical foundations for the language?'
OBJ2: term rewriting and initial algebra semantics.
Smalltalk: none.
Q: 'Is the language compiled?'
OBJ2: no. Smalltalk: yes.
Q: 'Is the language suitable for direct (compiled) execution on a
more-or-less conventional computer architecture?'
OBJ2: no. Smalltalk: yes.
COMMENT: Obviously these answers are not purely factual but
represent my opinion somewhat. I defend these as follows:
Smalltalk: Two smalltalk machines (one in Japan, and SOAR) have
been designed and either have been or are about to be built.
Another design is under way (the Caltech Object Machine).
OBJ2: The equality predicates of initial algebra semantics require
in the worst case unbounded computing time. (At least, I think they
do, and I think that OBJ2 allows as much expressive power in its
equality predicates.) Certainly hardware could be built to execute
these 'directly', but I argue that any machine instruction which may
not terminate is not 'more-or-less conventional computer
architecture'. Can anyone cite a counter-example instruction on any
standard architecture of today? (Note that termination by failure or
error is still termination.)
Note also these quotes:
"... lead us to regard OBJ as an ultra high level programming
programming language that can be executed ... on suitable
architectures, and that is especially suitable for
'fifth generation' applications ... ".
"OBJ is a 'logic programming' language ..."
"Although we originally thought of OBJ as a vehicle for testing
algebraic ADT specifications, we soon came to think of it as a
general purpose executable specification language ..."
I hope this has shed some light on the subject. My conclusion, for
those of you who haven't guessed it, is that OBJ2 is significantly
different from Smalltalk.
cheers,
Tim
Technical Details
Message-ID:
<741@unc.unc.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-spam!ames!ucbcad!ucbvax!decvax!mcnc!unc!rentschReferences:
<4000001@nucsrl.UUCP> <3288@milano.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-spam!ames!ucbcad!ucbvax!decvax!mcnc!unc!rentsch From: rentsch@unc.UUCP Newsgroups: comp.lang.misc Subject: OBJ2 and Smalltalk Message-ID: <741@unc.unc.UUCP> Date: Fri, 30-Jan-87 00:15:42 EST Article-I.D.: unc.741 Posted: Fri Jan 30 00:15:42 1987 Date-Received: Sat, 31-Jan-87 09:27:45 EST References: <4000001@nucsrl.UUCP> <3288@milano.UUCP> Reply-To: rentsch@unc.UUCP (Tim Rentsch) Organization: CS Dept, U. of N. Carolina, Chapel Hill Lines: 131