Newsgroups: comp.lang.scheme,comp.software-eng
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech2!news.mathworks.com!news.kei.com!world!mv!usenet
From: ENGR@GSSI.MV.COM (Michael Furman)
Subject: Re: Style: multiple returns and relatives
Message-ID: <DIwx9M.M61@mv.mv.com>
Mime-Version: 1.0
Organization: GSSI
Date: Fri, 1 Dec 1995 14:51:22 GMT
References: <RMARTIN.95Nov10210926@oma.com> <skfVWbO00VohAJimgc@andrew.cmu.edu> <BLUME.95Nov24173437@zayin.cs.princeton.edu> <49lcpq$s2i@cloner2.ix.netcom.com>
X-Newsreader: WinVN 0.93.10
X-Nntp-Posting-Host: gssi.mv.com
Lines: 68
Xref: glinda.oz.cs.cmu.edu comp.lang.scheme:14455 comp.software-eng:39666

In article <49lcpq$s2i@cloner2.ix.netcom.com>, JEThomas@ix.netcom.com says...
>
> --- snip ---
>
>Anyway, this is not the question I'm interested in.  Here's my
>question:  If you start with a well-defined specification for a
>program, what can keep a compiler for one language X from optimising it
>just as well as a compiler for another language Y?

  First problem is a definition of the "well-defined specification for a 
program". Sometimes (and often) it is trivial, but sometimes - not. You are 
going to put this specification as input for compiler - therefore it is a 
program. But problem of equivalence of two programs is really undesidable - 
not just for pathological programs. Look at ather articles of this thread - 
you will find some examples.
  OK, we are looking for value of X for which F(X) = 0. F(X) - some function, 
well defined but complicated. Imagine two ways to programs it:
  1 - try all calue of X, calculate F(X) and stop when F(X) is 0.
  2 - use some mathematical theories find that F(1.5) is 0 and write a
      program with just one significant statement: somthing like
      print(1.5).

Do you think that some compiler can optimize program 1 to program 2? Problem 
of finding solution for F(X) = 0 may be very hard (some posters metioned 
Ferma theorem).


>
>And the answer has to be, that language X throws away some of the given
>information, so that various things that compiler Y can optimise at
>compile-time are now unknown until later.

Yes, that is also a problem (like well discussed hear aliasing problem)

>
>And my obvious response to that is:  If you care about optimisation in
>language X then you should work out some method to avoid throwing away
>necessary information.

For trivial cases (like aliasing) we need to extend language (add declarator 
"noaliased" for example. For non trivial (like using some math theorem) I 
think it is impossible (in general). Because if you can not solve F(X) = 0
mathematically you still can write program 1, but can not provide information 
that can help compiler to optimize 1 to 2.

>
>I'm utterly uninterested in (correct, even) arguments that we can't
>prove whether two pathological programs give the same result.  I don't
>care whether such pathological programs can be shown to be possible.
>My sole interest in such programs is that I not write them, and the
>ones used for proofs are easy to avoid writing.

Studying some properties of any programs (including pathological, but not 
only them) help us to understend what can be done and what can not.

>
>(Actually I have a sneaking interest in such things, but I try to
>suppress it, having wasted too much of my youth on similar things.)
>

-- 
---------------------------------------------------------------
Michael Furman,                       (603)893-1109
Geophysical Survey Systems, Inc.  fax:(603)889-3984
13 Klein Drive - P.O. Box 97          engr@gssi.mv.com 
North Salem, NH 03073-0097            71543.1334@compuserve.com
---------------------------------------------------------------

