comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Vector (container) initialization: the schizophrenic ampersand
Date: Sat, 19 May 2012 11:28:31 +0200
Date: 2012-05-19T11:28:31+02:00	[thread overview]
Message-ID: <1mffjt3nlbzpb.1ew7gjb3p6mmh$.dlg@40tude.net> (raw)
In-Reply-To: 28845c63-b06c-4ac2-b5d5-e408c0ff4b7f@googlegroups.com

On Thu, 17 May 2012 23:51:52 -0700 (PDT), Marius Amado-Alves wrote:

> Adam is right: it is confusion with the predefined "&" for arrays, when
> the elements are arrays. (But the compiler error messages indicate
> undecision only between the two Vectors "&" functions.) So my new solution
> is
> 
> function "+" (L : My_Vectors.Vector; R : My_Element_Type) 
>    renames My_Vectors."&"; 
> 
> function "+" (L, R : My_Element_Type) 
>    renames My_Vectors."&"; 
> 
> V : My_Vectors.Vector := Element1 + Element2 + Element3;

What if My_Element_Type is numeric?

It is always problematic to mix sets and elements of. The idea to overload
an operation for both is attractive but guaranteed to have issues.

Semantically correct is: 

   (Element1, Element2, Element3)

Yet another trick to disambiguate:

   Empty & Element1 & Element2 & Element3

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



      parent reply	other threads:[~2012-05-19  9:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17 20:20 Vector (container) initialization: the schizophrenic ampersand Marius Amado-Alves
2012-05-17 20:24 ` Jeffrey Carter
2012-05-17 20:26 ` Pascal Obry
2012-05-17 23:33 ` Adam Beneschan
2012-05-18  6:34   ` Marius Amado-Alves
2012-05-18  6:51   ` Marius Amado-Alves
2012-05-18 13:31     ` Robert A Duff
2012-05-18 18:55       ` Shark8
2012-05-18 22:44         ` Robert A Duff
2012-05-19  9:03       ` Marius Amado-Alves
2012-05-19 16:15         ` Robert A Duff
2012-05-21 16:02           ` Adam Beneschan
2012-05-21 17:04             ` Robert A Duff
2012-05-21 17:57               ` Adam Beneschan
2012-05-21 15:57         ` Adam Beneschan
2012-05-19  9:28     ` Dmitry A. Kazakov [this message]
replies disabled

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