comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Constant as anonymous functions : the outer space beast is back
Date: Sat, 6 Feb 2010 10:34:02 +0100
Date: 2010-02-06T10:33:55+01:00	[thread overview]
Message-ID: <1n9a68gmk5lei.1wrfnycrpo1hc.dlg@40tude.net> (raw)
In-Reply-To: 9428b89d-1998-4d10-b244-89eac7c8d4ec@f12g2000yqn.googlegroups.com

On Fri, 5 Feb 2010 14:41:50 -0800 (PST), Hibou57 (Yannick Duch�ne) wrote:

> On 5 f�v, 22:51, "Randy Brukardt" <ra...@rrsoftware.com> 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



  reply	other threads:[~2010-02-06  9:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27  1:57 Constant as anonymous functions : the outer space beast is back Hibou57 (Yannick Duchêne)
2010-01-27  2:12 ` Robert A Duff
2010-01-27  2:15   ` Hibou57 (Yannick Duchêne)
2010-01-30  2:42   ` Randy Brukardt
2010-01-30  8:45     ` AdaMagica
2010-02-02 19:34       ` Hibou57 (Yannick Duchêne)
2010-02-05 21:51         ` Randy Brukardt
2010-02-05 22:41           ` Hibou57 (Yannick Duchêne)
2010-02-06  9:34             ` Dmitry A. Kazakov [this message]
2010-02-07 16:22         ` Robert A Duff
2010-02-09  0:22           ` Randy Brukardt
2010-02-02 19:36     ` Hibou57 (Yannick Duchêne)
2010-02-02 21:26     ` Adam Beneschan
2010-02-02 21:47       ` Hibou57 (Yannick Duchêne)
2010-02-03  0:55         ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox