From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Pascal Obry Newsgroups: comp.lang.ada Subject: Re: Functions vs constants Date: Thu, 24 Jul 2014 18:47:07 +0200 Organization: Home - http://www.obry.net Message-ID: <1406220427.16701.60.camel@pascal.home.net> References: Reply-To: pascal@obry.net NNTP-Posting-Host: p4NquHNjznoXP1gWlFZbqQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Complaints-To: abuse@aioe.org X-Mailer: Evolution 3.12.2-1+b1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:21189 Date: 2014-07-24T18:47:07+02:00 List-Id: Le mercredi 23 juillet 2014 =C3=A0 17:57 -0400, Robert A Duff a =C3=A9crit = :=20 > Those are equivalent in a pure functional language. Not in Ada. >=20 > E.g. a constant initialized to "new T" always denotes the same heap > object, whereas a function that says "return new T" returns a new > object every time it's called. So let's introduce the Once attribute from Eiffel language to solve that :) In Eiffel a Once function does whatever it is supposed to do the first time then it *always* returns the same result for subsequent calls. This then looks like a complex constant. --=20 Pascal Obry / Magny Les Hameaux (78) The best way to travel is by means of imagination http://v2p.fr.eu.org http://www.obry.net gpg --keyserver keys.gnupg.net --recv-key F949BD3B