Re: In a Pascal-like language, would being able to declare a subroutine as "purely functional" be of any value?

wclodius@los-alamos.net (William Clodius)
Tue, 15 Mar 2011 19:51:35 -0600

          From comp.compilers

Related articles
[2 earlier articles]
Re: In a Pascal-like language, would being able to declare a subroutin bobduff@shell01.TheWorld.com (Robert A Duff) (2011-03-11)
Re: In a Pascal-like language, would being able to declare a subroutin pdjpurchase@googlemail.com (1Z) (2011-03-11)
Re: In a Pascal-like language, would being able to declare a subroutin gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-12)
Re: In a Pascal-like language, would being able to declare a subroutin comp.lang.misc@inglorion.net (Robbert Haarman) (2011-03-12)
Re: In a Pascal-like language, would being able to declare a subroutin mcr@wildcard.demon.co.uk (Martin Rodgers) (2011-03-12)
Re: In a Pascal-like language, would being able to declare a subroutin noitalmost@cox.net (noitalmost) (2011-03-15)
Re: In a Pascal-like language, would being able to declare a subroutin wclodius@los-alamos.net (2011-03-15)
Re: In a Pascal-like language, would being able to declare a subroutin mcr@wildcard.demon.co.uk (Martin Rodgers) (2011-03-16)
Re: In a Pascal-like language, would being able to declare a subroutin sinu.nayak2001@gmail.com (Srinivas Nayak) (2011-03-16)
Re: In a Pascal-like language, would being able to declare a subroutin massimo_dentico@hotmail.com (Massimo A. Dentico) (2011-03-18)
Re: In a Pascal-like language, would being able to declare a subroutin gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-19)
Re: In a Pascal-like language, would being able to declare a subroutin sinu.nayak2001@gmail.com (Srinivas Nayak) (2011-03-21)
| List of all articles for this month |

From: wclodius@los-alamos.net (William Clodius)
Newsgroups: comp.compilers
Date: Tue, 15 Mar 2011 19:51:35 -0600
Organization: Compilers Central
References: 11-03-032 11-03-040
Keywords: design, optimize
Posted-Date: 15 Mar 2011 21:49:49 EDT

noitalmost <noitalmost@cox.net> wrote:


> <snip>
>
> I did a little looking at some of the languages that offer PURE. Ada
> and PL/I seem to be like programmer promises to the compiler that the
> function is pure. Are Fortran and the gcc extension the same way? Or
> do they offer compiler checks, like as happens for const in gcc C++?


In essence they are programmer promises, that in some circumstances
cannot be verified by the compiler. For Fortran for example if you call
C code or old style Fortran subprograms, the compiler will assume that
you aren't lieing to it. However if you use the preferred modern stlyle
and only invoke subprograms written in that style, so that all
interfaces are explicit, you make it possible for the compiler to detect
failure for the procedure to be "PURE", and other inconsistencies in
your API. In principle it could also tell you that it is unable to
verify the consistency of the API, although I don't know of any
compilers that do so.


--
Bill Clodius


Post a followup to this message

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