comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Strings with discriminated records
Date: Wed, 30 May 2018 15:09:54 -0500
Date: 2018-05-30T15:09:54-05:00	[thread overview]
Message-ID: <pen0eu$2fb$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: pelb5u$cqo$1@gioia.aioe.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2202 bytes --]


"J-P. Rosen" <rosen@adalog.fr> wrote in message 
news:pelb5u$cqo$1@gioia.aioe.org...
> Le 30/05/2018 à 00:41, Randy Brukardt a écrit :
...
>>(Of course,
>> the real problem above is "package use clauses", don't use (ahem) them 
>> and
>> you can't possibly have this problem.)
>> ????
> With use clauses, you'll have to write:
>    when Ada.IO_Exceptions.End_Error =>
>
> while without use clauses, you'll have to write:
>    when Ada.IO_Exceptions.End_Error =>
>
> I fail to see the "real problem". Use clauses make the code more
> readable, and when there is an ambiguity, you fall back to what you
> would do without them. What's the problem?

(A) The person I was responding to was upset that they had to write the 
fully qualified name in this case, and practically, they're right. (Tucker 
has complained about this multiple times.)

(B) But package use clauses make things visible that are not overloadable 
(like objects), so they tend to be a substantial maintenance hazard --  
adding something to a package can make client code using use clauses illegal 
because of conflicts. Adding unrelated stuff should *never* make any client 
illegal (changes, obviously are different).

If Ada had made objects/exceptions overloadable, this problem would be much 
less severe. But it didn't, and changing that now would be difficult to do 
without lots of subtle incompatibilities.

Use type/use all type (and better still, prefix calls) mostly avoid this 
problem by only operating on overloadable things. You still can get 
conflicts, but only when there are design issues (having multiple operations 
with the same name and profile means either there is unnecessary duplication 
[two routines doing the same thing] or that there is routines doing 
different things with the same name (yikes!).

In a best case world, a rename conflicting with the original routine or 
another rename of it would be ignored in all use clauses, along with 
overloading of objects/exceptions. That would reduce conflicts to a handful 
of cases. (If overloading of generics could be figured out, that would be 
even better.) But that has to wait for Ada++.

                                                    Randy.


  reply	other threads:[~2018-05-30 20:09 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 21:43 Strings with discriminated records NiGHTS
2018-05-26 23:42 ` Shark8
2018-05-27  1:42   ` NiGHTS
2018-05-27  8:39     ` Dmitry A. Kazakov
2018-05-27 12:22       ` Mehdi Saada
2018-05-27 12:40         ` Dmitry A. Kazakov
2018-05-27 14:34       ` NiGHTS
2018-05-27 14:50         ` Dmitry A. Kazakov
2018-05-27 15:19           ` NiGHTS
2018-05-27 15:32             ` AdaMagica
2018-05-27 16:22               ` NiGHTS
2018-05-29 22:31           ` Randy Brukardt
2018-05-30  7:29             ` Dmitry A. Kazakov
2018-05-30 20:11               ` Randy Brukardt
2018-05-27 12:48     ` Mehdi Saada
2018-05-27 13:03       ` Dmitry A. Kazakov
2018-05-27 17:11 ` NiGHTS
2018-05-27 18:07   ` Simon Wright
2018-05-27 23:08     ` NiGHTS
2018-05-28  1:44       ` Jere
2018-05-28  3:05         ` NiGHTS
2018-05-28  3:23           ` NiGHTS
2018-05-27 18:25   ` Dmitry A. Kazakov
2018-05-27 22:44     ` NiGHTS
2018-05-28  7:29       ` Dmitry A. Kazakov
2018-05-28  7:42       ` Simon Wright
2018-05-28 18:38         ` Shark8
2018-05-28 21:15           ` Mehdi Saada
2018-05-28 21:48             ` Shark8
2018-05-28 22:27               ` Mehdi Saada
2018-05-28 23:59                 ` Shark8
2018-05-29  0:41                   ` Dan'l Miller
2018-05-30 17:11                     ` Shark8
2018-05-29  7:49                 ` Dmitry A. Kazakov
2018-05-29  9:31                   ` AdaMagica
2018-05-29 10:14                     ` Dmitry A. Kazakov
2018-05-29 13:40                   ` Dan'l Miller
2018-05-29 14:04                     ` Dmitry A. Kazakov
2018-05-29 22:41                       ` Randy Brukardt
2018-05-30  5:00                         ` J-P. Rosen
2018-05-30 20:09                           ` Randy Brukardt [this message]
2018-05-31  4:19                             ` J-P. Rosen
2018-05-31 22:18                               ` Randy Brukardt
2018-06-01 13:35                                 ` Dan'l Miller
2018-06-01 15:20                                   ` Dmitry A. Kazakov
2018-05-28 13:55 ` NiGHTS
2018-05-29 14:37 ` Mehdi Saada
2018-05-29 22:44   ` Randy Brukardt
2018-05-29 22:41 ` Mehdi Saada
2018-05-30 19:46   ` Randy Brukardt
2018-05-30 19:48     ` Randy Brukardt
replies disabled

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