🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2954

Re: Dynamic typing -- To Have and Have Not (was R

#2954
From: David Gudeman
Date: Tue, 12 Mar 1991 17:15
33 lines
1642 bytes
In article  <19728:Mar1208:45:2291@kramden.acf.nyu.edu> Dan Bernstein writes:
]
]Given this, I fail to see how dynamic typing can be regarded as more
]than a syntactic feature. If you're given a program that uses dynamic
]typing, you can just convert every reference in the program to refer to
]a (type,value) pair, and poof! you have a statically typed program.

Alternatively: I fail to see how static typing can be regarded as more
than a syntacitic feature.  If you're given a program that uses static
typing, you can just check the types at every reference in the program
to make sure they are correct...

BTW, you can't just change the program to refer to a (type,value)
pair, you also have to insert code to do the right thing based on the
type.  For "x + y", you have to generate:

  switch (x.type) {
  case int_type:
    switch (y.type) {
    case int_type: return x.val.int + y.val.int
    case float_type: return x.val.int + y.val.float;
    default: type_error(y);
    }
  ...
  }

and so on, for each combination of types.  For more general
expressions like "x = y", you have to give code that works for any
possible combination of types -- not just numbers.
--
					David Gudeman
gudeman@cs.arizona.edu
noao!arizona!gudeman
Technical Details
Message-ID: <608@optima.cs.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!caen!news.cs.indiana.edu!arizona.edu!arizona!gudeman

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!caen!news.cs.indiana.edu!arizona.edu!arizona!gudeman
From: gudeman@cs.arizona.edu (David Gudeman)
Newsgroups: comp.lang.misc
Subject: Re: Dynamic typing -- To Have and Have Not (was R
Message-ID: <608@optima.cs.arizona.edu>
Date: 12 Mar 91 17:15:23 GMT
Sender: news@cs.arizona.edu
Lines: 33