Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!ucsd!ucbvax!UM.CC.UMICH.EDU!Paul_Abrahams%Wayne-MTS From: Paul_Abrahams%Wayne-MTS@UM.CC.UMICH.EDU Newsgroups: comp.lang.icon Subject: Uses of dynamic typing Message-ID: <270675@Wayne-MTS> Date: 17 Nov 90 01:47:38 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 25 As I mentioned in an earlier posting, I'm working on the design of SPLASH, a Systems Programming Language for Software Hackers. A question came up about how people use Icon's dynamic typing. In Icon the type of a variable isn't determined until you assign something to it, and even then it can change. That's in contrast with other languages of the Algol/Pascal/Ada/C sort, in which every variable has a declared type. My question is: how important is this flexibility for Icon programming, and how do people utilize it? There's one place where it clearly pays off: the possibility of writing a procedure that prints its argument no matter what the type of the argument. The fact that you can't write the C printf function in standard C shows why you want this. But aside from printing arguments and writing out their storage, I haven't been able to think of other operations that use the flexibility. Interestingly, sorting isn't one of those examples, since not all data types have a natural ordering relation and even for those that do, you use different operators in Icon (`<' for numbers, `<<' for strings.) Examples, anyone--particularly from programs that do something rather than just prove something? Paul Abrahams abrahams%wayne-mts@um.cc.umich.edu