comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Fun: the Ada assignment operator is an alias of the equivalence operator
Date: Sat, 28 May 2011 11:03:25 +0200
Date: 2011-05-28T11:03:27+02:00	[thread overview]
Message-ID: <1ahuqa8azzgr4.pb0vclmr8vm6.dlg@40tude.net> (raw)
In-Reply-To: op.vv6ly1vkule2fv@douda-yannick

On Sat, 28 May 2011 10:02:51 +0200, Yannick Duch�ne (Hibou57) wrote:

>> Assignment is not a logical operation, variables are not logical
>> predicates.
> Nor "defined-as" is ;)
> 
> ":=" would be OK for constant, makes Ada looks a bit more functional :p

I think it is a widely shared misconception that immutability has anything
to do with that. [Functional is not an answer, whatever the question was
(:-))]

No, even an initialized constant is not necessarily equivalent to its
initializing expression. Obvious examples:

   I : constant Integer := Get (File);
   X : constant Float := Random (Dice);
   T : constant Time := Clock;

Another point is that equivalence itself is an abstract operation with the
semantics undefined in general.

Mathematical equivalence = is not analogous to "=" operation defined on
objects. Rather it is:

1. Values equivalence (values do not belong to the program). I.e. you can
say that the value of the variable A is equivalent to the value of the
variable B. Which is unrelated [not required] to whether A=B yields True or
False.

2. Program equivalence. You can say that two programs are equivalent in
some [limited] sense, e.g. when the compiler optimizes the code, or when
you modify the program.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2011-05-28  9:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28  0:48 Fun: the Ada assignment operator is an alias of the equivalence operator Yannick Duchêne (Hibou57)
2011-05-28  7:25 ` Dmitry A. Kazakov
2011-05-28  8:02   ` Yannick Duchêne (Hibou57)
2011-05-28  9:03     ` Dmitry A. Kazakov [this message]
2011-05-28  9:19       ` Yannick Duchêne (Hibou57)
2011-05-28  9:58         ` Dmitry A. Kazakov
replies disabled

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