Article View: comp.lang.misc
Article #6629Re: An Interesting View of "Strong" Vs. "Weak" Typing
From: Keith Waclena
Date: Wed, 10 Jan 1990 21:21
Date: Wed, 10 Jan 1990 21:21
65 lines
3361 bytes
3361 bytes
In article <16678@megaron.cs.arizona.edu>, gudeman@cs (David Gudeman) writes:
>In article <7049@tank.uchicago.edu> keith@curry.uchicago.edu (Keith Waclena [me]) writes:
>
>>Don't you think the distinction between ``dynamic typing'' and
>>``static typing'' is a useful one? The distinction is, who knows the
>>types: the compiler or the run-time system?
>
>Well, you make a good case for the distinction, but I have some
>reservations. First, the distinction between compiler and run-time
>system is itself somewhat artifical.
This is true; the distinction is barely there in a language like
Forth, and is fuzzed in a language like Miranda (where some code
optimization happens the first time a particular piece of (combinator)
code is executed).
>
>>I would say that C is weakly typed (or untyped) dynamically, and
>>strongly-typed (but not too strongly) statically...
>
>This last sentence bothers me. It would be quite simple to implement
>a C operator such as "(typeof) x" that returns some representation of
>the type of the variable x. Granted this operator _does_ have to
>refer to the type information gathered at compile time (it probably
>would be treated as a compile-time constant, like "(sizeof) x"), but
>the type of x is still available at run-time.
I'm not sure in what sense it would be simple to implement a typeof in
C (only a compiler-writer could do so; you can't implement typeof *in
the language*). It can't be done as a compile-time operator (like
sizeof) except for identifiers (see below), while the type-of-like
operators of Icon and Common Lisp work on values. Because C allows
unions and pointers you would have to have runtime tags to do this.
>
>The advantage of this terminology is that it does not refer to the
>distinction between compiler and run-time system, except where the
>distinction is an inherent part of what you are talking about.
Perhaps I was being a little too informal in using those terms. I
think the real distinction is between associating type information
with identifiers (l-values) and associating it with data (r-values).
A language can do one, or the other, or both, and it can do either
strongly or weakly. For an interesting article discussing this, see:
%A Hamish I. E. Gunn
%A David M. Harland
%T Degrees of Constancy in Programming Languages
%J Information Processing Letters
%V 13
%N 1
%D 27 October 1981
%P 35-38
%K dynamic constants; tagged architectures
/Keith
--
Keith WACLENA keith@curry.uchicago.edu
CILS / TIRA / U of Chicago keith%curry@uchimvs1.bitnet
1100 E.57th.St Chi IL 60637 USA ...!uunet!curry.uchicago.edu!keith
"Immer Sicherheitsfruchthalter benutzen!" -- A. Boerner, Gmbh.
Technical Details
Message-ID:
<7106@tank.uchicago.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!tank!keith@curry.uchicago.eduReferences:
<16678@megaron.cs.arizona.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!tank!keith@curry.uchicago.edu From: keith@curry.uchicago.edu (Keith Waclena) Newsgroups: comp.lang.misc Subject: Re: An Interesting View of "Strong" Vs. "Weak" Typing Message-ID: <7106@tank.uchicago.edu> Date: 10 Jan 90 21:21:15 GMT References: <16678@megaron.cs.arizona.edu> Sender: news@tank.uchicago.edu Reply-To: keith@curry.uchicago.edu (Keith Waclena) Organization: TIRA / UofC Lines: 65 In-reply-to: gudeman@cs.arizona.edu (David Gudeman)