Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!crackers!m2c!umvlsi!dime!yodaiken From: yodaiken@chelm.cs.umass.edu (victor yodaiken) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 3) Message-ID: <28937@dime.cs.umass.edu> Date: 7 Apr 91 03:55:34 GMT References: <28875@dime.cs.umass.edu> <49907@nigel.ee.udel.edu> <28924@dime.cs.umass.edu> Sender: news@dime.cs.umass.edu Reply-To: yodaiken@chelm.cs.umass.edu (victor yodaiken) Organization: University of Massachusetts, Amherst Lines: 26 In article olson@lear.juliet.ll.mit.edu ( Steve Olson) writes: > >In article <28924@dime.cs.umass.edu> yodaiken@chelm.cs.umass.edu (victor yodaiken) writes: > The problem with "untyped" expressions is that they are inherently > ambiguous. If I'm writing about semigroups and regular languages I must > tell you when a*b is concatenation and when it is semigroup addition. > Figuring this out from the context alone is difficult for most people. > >This sounds more like overuse of operator overloading rather than anything >having to do with static vs. dynamic typing. This problem could occur just as >easily in C++ as in CLOS. If you never want to mix the two types then >renaming the operators will remove all confusion. If you do want to mix the >two types then the problem is the same whether you are using a dynamically >typed language or a statically typed sortof-dynamic-typing-through-subclassing- >and-virtual-functions language. I don't want to have to give up overloading -- one of the real conveniences of mathematical notation. But if I declare variable types, there is no problem. So, if I write: let a,b be elements of the alphabet and let a',b' be the corresponding elements of the semigroup, then a*b and a'*b' are easy to distinguish. By making the types of the variables explicit, I make the overloading of * unambiguous. An expression a*b' where the two variables have different types makes no sense in this context and I'd like the compiler to catch it.