comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Copy vector in Ada
Date: Sat, 3 Nov 2012 14:57:28 -0700 (PDT)
Date: 2012-11-03T14:57:28-07:00	[thread overview]
Message-ID: <6260a796-83c4-4ce5-88cb-8249846bc035@googlegroups.com> (raw)
In-Reply-To: <op.wm7f72j3ule2fv@cardamome>

W dniu sobota, 3 listopada 2012 17:03:33 UTC+1 użytkownik Hibou57 (Yannick Duchêne) napisał:

> Some other words: I hardly believe an assignment operator could ever be OK  
> within a context where the meaning of what an object is depends on whether  
> it is used by value or reference (the truncation case Peter made me  
> recall), and where there's nothing like proper class wide type, as C++  
> class wide behaviour also depends on whether an instance is used by value  
> vs by reference (always class wide with reference). Can you make an  
> assignment operator works fine and uniformly in such circumstances?

No and I don't even intend to do it. Mixing assignment with polymorphism is evil and cannot be implemented reasonably anyway. In the case of derivation hierarchy I would rather introduce the "clone" operation or something equivalent. Interestingly, in the hierarchy I would also ban the copying entirely, which means that pass by copy becomes impossible and the whole problem of uniformity just disappears.

Note that Ada does not provide any universal solution to this problem, either - assignment cannot be reasonably implemented apart from the case of matching tags, which introduces a run-time aspect to the whole; this is in contrast to banning assignment, which in terms of limitedness is always resolved statically.
It's a bit messy.

> The
> orthogonality C++ lacks here is a fact to be added to the particular point  
> you raised.

Not much. In the case of derivation hierarchy, neither Ada nor C++ offer anything useful (and that's OK as the concept is broken anyway). C++ does provide a cleaner solution for the case of non-dispatching assignment.

-- 
Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com



  reply	other threads:[~2012-11-03 21:57 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 16:26 Copy vector in Ada katolsster
2012-10-31 16:37 ` Jeffrey Carter
2012-11-02 11:10   ` katarina.l.olsson
2012-11-02 11:19     ` Yannick Duchêne (Hibou57)
2012-11-02 22:03       ` Maciej Sobczak
2012-11-02 23:45         ` Yannick Duchêne (Hibou57)
2012-11-03  0:15           ` Zhu, Qun-Ying
2012-11-03  3:47             ` Peter C. Chapin
2012-11-03 15:47               ` Yannick Duchêne (Hibou57)
2012-11-03 14:34           ` Maciej Sobczak
2012-11-03 15:54             ` Yannick Duchêne (Hibou57)
2012-11-03 16:03               ` Yannick Duchêne (Hibou57)
2012-11-03 21:57                 ` Maciej Sobczak [this message]
2012-11-04  7:25                   ` Dmitry A. Kazakov
2012-11-04 20:49                     ` Maciej Sobczak
2012-11-05  8:31                       ` Dmitry A. Kazakov
2012-11-05  8:50                         ` Maciej Sobczak
2012-11-05  9:20                           ` Dmitry A. Kazakov
2012-11-05 17:22                             ` Yannick Duchêne (Hibou57)
2012-11-05 18:42                               ` Dmitry A. Kazakov
2012-11-05 20:18                                 ` Yannick Duchêne (Hibou57)
2012-11-05 20:33                                   ` Dmitry A. Kazakov
2012-11-05 21:34                                     ` Yannick Duchêne (Hibou57)
2012-11-05 23:45                                       ` Shark8
2012-11-05 23:58                                         ` Hibou57 (Yannick Duchêne)
2012-11-06  2:17                                           ` Yannick Duchêne (Hibou57)
2012-11-06  7:28                                             ` Types vs Subtypes (was: Re: Copy vector in Ada) Simon Wright
2012-11-06 11:33                                             ` Copy vector in Ada Georg Bauhaus
2012-11-06 19:47                                               ` Yannick Duchêne (Hibou57)
2012-11-06 19:53                                                 ` Yannick Duchêne (Hibou57)
2012-11-07 12:03                                                 ` Georg Bauhaus
2012-11-07 13:09                                                   ` Dmitry A. Kazakov
2012-11-07 16:17                                                     ` Yannick Duchêne (Hibou57)
2012-11-07 16:11                                                   ` Yannick Duchêne (Hibou57)
2012-11-07 18:06                                                     ` Georg Bauhaus
2012-11-07 20:04                                                       ` Dmitry A. Kazakov
2012-11-07 21:00                                                         ` Yannick Duchêne (Hibou57)
2012-11-08  8:31                                                           ` Dmitry A. Kazakov
2012-11-08  9:58                                                         ` Georg Bauhaus
2012-11-08 14:28                                                           ` Dmitry A. Kazakov
2012-11-05 16:30                         ` Yannick Duchêne (Hibou57)
2012-11-02 14:10     ` Georg Bauhaus
2012-11-02 15:28       ` Shark8
2012-11-09  6:22         ` Randy Brukardt
2012-11-19 22:37 ` Katarina Olsson
2012-11-19 22:39 ` Katarina Olsson
replies disabled

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