Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!ukc!pyrltd!tetrauk!rick From: rick@tetrauk.UUCP (Rick Jones) Newsgroups: comp.object Subject: Re: A Hard Problem for Static Type Systems Message-ID: <1162@tetrauk.UUCP> Date: 10 May 91 16:20:01 GMT References: <1991Apr20.010347.28984@leland.Stanford.EDU> <554@eiffel.UUCP> <1991Apr26.203642.17387@leland.Stanford.EDU> <556@eiffel.UUCP> <1146@tetrauk.UUCP> <2479@m1.cs.man.ac.uk> <1158@tetrauk.UUCP> <2500@m1.cs.man.ac.uk> Reply-To: rick@tetrauk.UUCP (Rick Jones) Organization: Tetra Ltd., Maidenhead, UK Lines: 63 In article <2500@m1.cs.man.ac.uk> mario@cs.man.ac.uk (Mario Wolczko) writes: >In article <1158@tetrauk.UUCP>, rick@tetrauk.UUCP (Rick Jones) writes: >[long defence of global type analysis, followed by critique of my 6 >line program fragment] > >But now you're moving the goalposts. Your original posting stated >quite unequivocally that global type analysis only rejected programs >that were not type-safe, and my example showed that this was false. Well, I didn't think I was moving them - but I accept that I probably didn't make clear enough where I was planting them to start with. >I feel sure that we could argue until blue in the face as to what >constitutes a well-designed program. My guess is that your bottom >line will be that any program which is not amenable to global type >analysis is not well-designed! You could be right - how one approaches design is to some degree a subjective matter. The constraints of Eiffel's type system, including GTA (which Bertrand Meyer commented has always been present as implicit rules anyway), do not present themselves to me as impediments to program design - if anything, I find them to be aids. I say this from practical experience, not just ideology. I have not used Smalltalk for any serious work, only played with it, but my feeling is that if I were to tackle a project with it, I would design things in a different way. I can't say exactly how it would be different, I would need some experience to say any more. I tend to get the feeling that a lot of the "static v. dynamic" debate is in fact a debate between programmers of the procedural-based school (typified by Eiffel and C++), and those of the Smalltalk school. The underlying styles are so different that the typing issue is really only one part of the distinction. A design which works well in Eiffel may not transfer directly to Smalltalk, nor vice-versa. However, the same _problem_ can be solved equally well in either environment, if given to designers/programmers with equivalent familiarity in the respective systems; they will just build it differently. Since everyone works best in the environment in which they feel most familiar, they naturally tend also to feel it is the best environment. There is in fact no absolute criteria of "best" - it is in the end all subjective. >I will make only two further observations: >1. Eiffel's "reverse assignment attempt" is a run-time type test > anyway, and True, but being an assignment between types it operates within the type system rather than against it, which I find works very cleanly. >2. The most common "type error" in Smalltalk is sending a message to > nil, ie forgetting to initialize a variable. Static typing doesn't > help here at all. And also, of course, in Eiffel (trappable by an implicit assertion). Unless there are no void references permitted - which introduces other problems - there seems to be no practical way around this. Now if this could be deduced statically ...! but I guess that takes us into formal proofs, at which point I exit stage left and leave it to others. -- Rick Jones, Tetra Ltd. Maidenhead, Berks, UK rick@tetrauk.uucp Any fool can provide a solution - the problem is to understand the problem