comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: User defined implicit conversion
Date: Wed, 30 Oct 2019 19:58:17 +0000
Date: 2019-10-30T19:58:17+00:00	[thread overview]
Message-ID: <lyeeyuxaxy.fsf@pushface.org> (raw)
In-Reply-To: d9269cae-93e5-428c-9c7c-a7a1f5679806@googlegroups.com

Alain De Vos <devosalain71@gmail.com> writes:

> Casting from one type to another is a real pain.
> Does the functionality "User defined implicit conversion" exists?
> If not are there strategies, general rules, to limit conversion to a
> minimum ?
>
> We don't want as concatination :
> result := to_type_a (from_type_a (X) & from_type_a (Y)) ;
> when you could have :
> result := X & Y ;

   function "&" (L : Type_X, R : Type_Y) return Type_A;
   function "&" (L : Type_Y, R : Type_X) return Type_A;

which means that the tiresome manipulation only has to happen in one
place. Well, two places, unless you say

   function "&" (L : Type_Y, R : Type_X) return Type_A
   is (R & L);


  reply	other threads:[~2019-10-30 19:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 19:43 User defined implicit conversion Alain De Vos
2019-10-30 19:58 ` Simon Wright [this message]
2019-10-30 20:39 ` Egil H H
2019-10-30 21:26 ` Randy Brukardt
2019-10-30 22:17   ` Dmitry A. Kazakov
2019-11-06  6:19   ` G. B.
2019-10-31 11:18 ` AdaMagica
replies disabled

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