Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!SOPHIST.UCHICAGO.EDU!goer From: goer@SOPHIST.UCHICAGO.EDU (Richard Goerwitz) Newsgroups: comp.lang.icon Subject: type coercion Message-ID: <9004111306.AA07853@sophist.uchicago.edu> Date: 11 Apr 90 13:06:19 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 35 Consider the following: Static type checking is not realistically possible for a language such as Icon. Consider the expression: if x=0 then "small" else 1 The type of this expression may be impossible to determine until run time. In Icon as well as such expressions as these it is possible to check the type of a value at run time and act according to this information. I have used this myself to obtain the behaviour of variant types. For example: if type(x)=="integer" then x+1 else 0 Expressions such as this are quite foreign to languages with static type checking. Perhaps what you need is some kind of "lint" program like that which the C programming language has. For programs which can be statically typed it could warn of any type clashes and coercions that will occur, for other programs it could just indicate that static type checking was not feasible. I don't disagree that expressions such as this are foreign to languages with static type checking. What I wonder is whether a thing like optional static typing might be applied to variables, and not expressions. In this scenario, if x = 0 then "small" else 1 would be fine. Just curious. -Richard L. Goerwitz goer%sophist@uchicago.bitnet goer@sophist.uchicago.edu rutgers!oddjob!gide!sophist!goer