From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/03 Message-ID: <611r0u$9sk$1@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 277490272 References: <3431A2DB.4273@EasyInternet.net> <34326556.2216DC70@virginia.edu> <5l90wd2sbj.fsf@tequila.systemsz.cs.yale.edu> <60uek7$fon$1@lyra.csx.cam.ac.uk> <5l7mbw2cb3.fsf@tequila.systemsz.cs.yale.edu> Organization: Comp Sci, RMIT University, Melbourne, Australia. NNTP-Posting-User: ok Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec Stefan Monnier writes: >I'm sorry, but I can't seem to remember that Pascal disallows aliasing (I >honestly don't know about Algol). Furthermore, do you really believe that >aliasing information would help for GUI-like code ? Do you mean "code like that which USES a GUI" or "code like that which IMPLEMENTS a GUI"? I note that one of my favourite languages (Clean) has an elegant GUI *using* interface which has complete freedom from aliasing. Clean is a *pure* lazy functional language, there are no assignments at all. The intention is that the compiler will _implement_ "make a record/array just like this one except for these few differences" destructively, _but_ only when it is safe, and the type system tells the compiler at compile time which references are the only reference to such a datum. Let me offer an example: :: Complex = { re :: Real, im :: Real } conj_in_place : *Complex -> *Complex conj_in_place c=:{im=i} = {c & im= ~i} The * here in front of the type before the arrow means that a call to this function is legal only if the compiler can prove that this is the _only_ reference remaining to that record. The * in front of the type after the arrow means that there will be no other references to the result. Because the argument is 'dead' after the call, the compiler is allowed to update it in place. The uniqueness type system in Clean is surprisingly easy to use, and it means that the compiler can be *certain* that aliasing is not taking place. (To be fair, since Clean is a higher order language with Haskell-ish type classes, it has its own fair share of calling functions via pointers.) As for code that *implements* a GUI, the bit-shuffling stuff that gets done in the server would indeed benefit from a language that allows more and better optimisation. >Do you really think the problem is due to coding style (like the Xwin >code) and to programming languages (like C) rather than to what is being >coded (like a user interface rather than a numerical simulation) ? Yep. I keep on pointing out to students here (with examples) that the *really* big speedups come from high level reasoning that eliminates operations completely, rather than from *manual* low-level fiddling. Computer hardware has changed *immensely* in my lifetime. My intuition about what is fast and what is slow keeps needing dramatic revision. The one guideline that still works after 20 years is "keep your code as clean as possible so that the compiler has a chance of figuring out what's supposed to happen". (Well, there's another one: keep your working set small; avoid going to slow memory if you can; if you can't avoid that, avoid the disc; if you can't avoid disc, avoid tape; and whatever you do, don't use paper tape.) >> For efficient use of modern architectures, we need languages in which we >> programmers can express what we want to say in a fashion that can be >> converted to the sort of instruction stream that executes fast. And >> the current trends are in exactly the opposite direction. >Because the trend is to say "CPUs are fast enough, let's care about >programmer's convenience". Hmm. Current trends include C, C++, and Java, which are all of them remarkably opposed to the programmer's convenience. (I have a hard time believing how clumsy and verbose Java is.) -- John �neas Byron O'Keefe; 1921/02/04-1997/09/27; TLG,TLTA,BBTNOTL. Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.