Re: Safety and legality of optimizations

Charles Fiterman <cef@geodesic.com>
Sat, 15 Apr 1995 04:04:12 GMT

          From comp.compilers

Related articles
Re: Optimizing Across && And || bart@cs.uoregon.edu (1995-02-23)
Re: Safety and legality of optimizations cliffc@crocus.hpl.hp.com (1995-03-21)
Re: Safety and legality of optimizations Vinod.Grover@Eng.Sun.COM (1995-03-28)
Re: Safety and legality of optimizations cliffc@crocus.hpl.hp.com (1995-04-03)
Re: Safety and legality of optimizations cef@geodesic.com (Charles Fiterman) (1995-04-15)
Re: Safety and legality of optimizations Dave@OCCL-CAM.DEMON.CO.UK (Dave Lloyd) (1995-04-18)
Re: Safety and legality of optimizations cliffc@crocus.hpl.hp.com (1995-04-17)
Re: Safety and legality of optimizations jim@meiko.co.uk (1995-04-21)
Re: Safety and legality of optimizations clodius@lanl.gov (1995-04-26)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Charles Fiterman <cef@geodesic.com>
Keywords: optimize, design
Organization: Geodesic Systems
References: 95-02-179 95-04-050
Date: Sat, 15 Apr 1995 04:04:12 GMT

How about a pure keyword. Pure means this is a pure function. It
looks at its parameters and returns a value, it has no side effects.


Calls to pure functions can be lifted out of loops or even done at
compile time if the right things are known at compile time.


Now add an error function. error reports an error via the means
in place at the time. A pure function say square_root can call
error say to report a negative parm. If it happens at compile time
you get a compile time error. If it happens at run time you
get a run time error.


Note a function that calls error is not strictly pure. Neither is
a function that memoizes. Pure says this may be used as if it was
pure. Being able to attach the word to impure functions is the
best use of pure.


Now I drift over to type checking. In this context type checking is
is just another function. Running it at compile time has advantages
in speed and safety, deferring to run time has advantages in flexibility.
But all checking functions are like that. Moving an application from
prototype form to systems engineering form is largely moving the
checking functions from run time to compile time. Type checking is
an excellent target but not the only one.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.