From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Carbon
Date: Fri, 2 Sep 2022 19:23:21 -0500 [thread overview]
Message-ID: <teu6pr$2m3oc$1@dont-email.me> (raw)
In-Reply-To: jneucmFn478U1@mid.individual.net
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1675 bytes --]
"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message
news:jneucmFn478U1@mid.individual.net...
> On 2022-09-02 17:59, J-P. Rosen wrote:
>> Le 02/09/2022 à 16:18, G.B. a écrit :
>>> On 01.09.22 08:46, J-P. Rosen wrote:
>>>> Le 28/08/2022 à 19:34, G.B. a écrit :
>>>>> Also the convenience of being able to compare two objects for
>>>>> being the same object, using "===" in some languages---out of the box!
>>>>>
>>>>> procedure same_object (A : T; B in out T) is
>>>>> begin
>>>>> what_do_i_put_here; -- ?
>>>> A'Has_Same_Storage (B);
>>>>> end same_object;
>>>>
>>>> Of course, this procedure should be a function...
>>>
>>> Cool, new attributes.
Not very new, these were added in Ada 2012. They were considered inportant
for some preconditions.
>>>
>>> Is the expectation that A and B occupy the same
>>> bits if I pass the same X as an actual for both?
>> Yes.
>
>
> Surely only if their type (T, above) is passed by-reference?
>
> G.B.'s post had a later example where T is "range 1 .. 10", which is a
> by-copy type, so there A and B would be separate copies of X.
Agreed. Parameters of a by-copy type are separate objects from the actual
objects. Parameters of a by-reference type (like tagged types) are the same
objects. Parameters of types which are not specified as either may or may
not be new objects. And of course, Has_Same_Storage only if true when an
object is not copied. So the technique shown only certainly works for
by-reference types. The compiler can copy other types when it wants, so it
isn't meaningful to compare objects (only values).
Randy.
next prev parent reply other threads:[~2022-09-03 0:23 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 21:13 Carbon Gautier write-only address
2022-07-23 9:09 ` Carbon John McCabe
2022-07-23 13:14 ` Carbon Dmitry A. Kazakov
2022-07-23 13:49 ` Carbon Stéphane Rivière
2022-07-24 9:09 ` Carbon Jeffrey R.Carter
2022-07-24 9:22 ` Carbon Dmitry A. Kazakov
2022-07-24 9:38 ` Carbon Luke A. Guest
2022-07-26 17:31 ` Carbon John McCabe
2022-07-27 8:10 ` Carbon Luke A. Guest
2022-07-27 17:24 ` Carbon John McCabe
2022-07-27 20:00 ` Carbon Luke A. Guest
2022-07-28 23:48 ` Carbon Nasser M. Abbasi
2022-07-29 4:34 ` Carbon Devin Rozsas
2022-07-29 11:03 ` Carbon John McCabe
2022-07-29 19:05 ` Carbon Gautier write-only address
2022-07-30 9:16 ` Carbon John McCabe
2022-07-30 8:11 ` Carbon G.B.
2022-07-29 18:59 ` Carbon Gautier write-only address
2022-07-30 4:26 ` Carbon Nasser M. Abbasi
2022-07-30 9:21 ` Carbon John McCabe
2022-07-30 1:40 ` Carbon Paul Rubin
2022-07-30 4:23 ` Carbon Nasser M. Abbasi
2022-08-06 14:18 ` Carbon dennis knorr
2022-08-06 17:48 ` Carbon A.J.
2022-08-07 9:08 ` Carbon G.B.
2022-08-08 21:38 ` Carbon dennis knorr
2022-08-08 22:28 ` Carbon Dmitry A. Kazakov
2022-08-09 4:12 ` Carbon Randy Brukardt
2022-08-09 6:05 ` Carbon Paul Rubin
2022-08-09 7:22 ` Carbon John McCabe
2022-08-10 1:19 ` Carbon John Perry
2022-08-10 6:20 ` Carbon Paul Rubin
2022-08-10 17:58 ` Carbon John Perry
2022-08-10 18:10 ` Carbon Dennis Lee Bieber
2022-08-10 8:24 ` Carbon Luke A. Guest
2022-08-10 17:59 ` Carbon John Perry
2022-08-18 1:02 ` Carbon Randy Brukardt
2022-08-27 9:49 ` Carbon John McCabe
2022-07-27 20:39 ` Carbon Simon Wright
2022-07-27 23:30 ` Carbon John McCabe
2022-08-25 9:14 ` Carbon Fabien Chouteau
2022-08-25 17:55 ` Carbon John Perry
2022-08-26 18:59 ` Carbon Olivier Henley
2022-08-26 20:23 ` Carbon Paul Rubin
2022-08-26 20:59 ` Carbon Olivier Henley
2022-08-26 21:40 ` Carbon Paul Rubin
2022-08-26 22:18 ` Carbon Olivier Henley
2022-08-27 0:06 ` Carbon Paul Rubin
2022-08-28 0:30 ` Carbon John McCabe
2022-08-28 1:32 ` Carbon Paul Rubin
2022-08-28 8:57 ` Carbon John McCabe
2022-08-28 17:34 ` Carbon G.B.
2022-09-01 6:46 ` Carbon J-P. Rosen
2022-09-02 14:18 ` Carbon G.B.
2022-09-02 14:59 ` Carbon J-P. Rosen
2022-09-02 17:55 ` Carbon Niklas Holsti
2022-09-02 18:45 ` Carbon J-P. Rosen
2022-09-03 0:23 ` Randy Brukardt [this message]
2022-08-28 20:43 ` Carbon Paul Rubin
2022-08-29 8:57 ` Carbon John McCabe
2022-08-28 0:14 ` Carbon John McCabe
2022-08-28 17:39 ` Carbon G.B.
2022-08-28 18:24 ` Carbon Paul Rubin
2022-08-26 23:21 ` Carbon Jeffrey R.Carter
2022-08-27 11:27 ` Carbon Rod Kay
2022-08-27 15:20 ` Carbon John Perry
2022-08-27 23:47 ` Carbon John McCabe
2022-08-27 23:39 ` Carbon John McCabe
2022-07-27 8:45 ` Carbon Luke A. Guest
2022-07-27 13:16 ` Carbon Patrick Georgi
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox