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 X-Google-Thread: a07f3367d7,16f39b4f57339dcb X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder.news-service.com!weretis.net!feeder2.news.weretis.net!news.musoftware.de!wum.musoftware.de!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Constant as anonymous functions : the outer space beast is back Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <3c43bf9d-75f1-4d09-9388-65b83cafb1d9@j14g2000yqm.googlegroups.com> <454c900f-85ed-4a40-ad13-a5b432261b99@c29g2000yqd.googlegroups.com> <9428b89d-1998-4d10-b244-89eac7c8d4ec@f12g2000yqn.googlegroups.com> Date: Sat, 6 Feb 2010 10:34:02 +0100 Message-ID: <1n9a68gmk5lei.1wrfnycrpo1hc.dlg@40tude.net> NNTP-Posting-Date: 06 Feb 2010 10:33:55 CET NNTP-Posting-Host: 415c7fdd.newsspool4.arcor-online.net X-Trace: DXC=^o^59AR=G@eFXUDVUnEXQm4IUK On Fri, 5 Feb 2010 14:41:50 -0800 (PST), Hibou57 (Yannick Duch�ne) wrote: > On 5 f�v, 22:51, "Randy Brukardt" wrote: >> It's clear that you haven't thought this through very well. Adam notes >> that you could just change the behavior of constants declared with >> "constant", but that makes no sense -- a renames of a constant object >> does not include the keyword constant. So such a "simple" rule >> wouldn't work. > I confess the rename case is a thorn there. > > Good or bad, by the way ? > > I not aware enough of some rationale, but I feel the Constant keyword > should be part of Constant renaming. Possibly, however, obviously, anything that appears in a renaming beyond the names is a noise. It is present in order to hint what is going to be renamed in presence of potential overloading. From that point of view, yes, allowing overloaded constants could require more noise. >> Moreover, it doesn't make sense to treat constants and variables >> differently. > Does it make more sens to treat functions without parameter and > constants differently ? However, there is a tricky semantic issue. When you refer to a function, do you to the object of, or else to the object of the function result evaluated on the current context? Is it lazy or eager? Since pure functions are still "not Ada", it is dangerous to introduce this sort of equivalence you propose. Only a pure function [pure relatively to the contexts where it is evaluated] is equivalent to a constant. And further if some day functions to become first-class citizens in Ada, things will be even more complicated. >> Otherwise it ought to behave >> identically. Making the visibility rules wildly different for constants and >> variables would not have that effect (it's quite likely changing a constant >> to a variable would make some if it's uses illegal using your rule). > Semantically, a constant is not a variable. No, surely it is. Semantically a constant of the type T refers to an object (maybe transient) of a subtype of T, such that all mutating operations are disallowed. Variable of the type T refers to an object of the type T. The only difference is in the types: T vs. "constant T" (officially, Ada does not have constant subtypes) That a constant object can be transient is an implementation detail. > I don't have any trouble with Use clauses, I am never Using. Well, there are many "use"-haters among Ada people. (:-)) I am a "with"-hater. I prefer to design the packages, so that one could use plain names. Unfortunately there are many problems with that because of generics and lacking means to inherit the declarative region of another package. The latter will probably be addressed in Ada 2015. The former only will be if we abolish generics. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de