Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

UNIX enhancements aren't.


devel / comp.lang.ada / Re: use clauses

SubjectAuthor
* use clausesThomas
`* Re: use clausesRandy Brukardt
 +* Re: use clauses25.BX944
 |+- Re: use clausesEmmanuel Briot
 |`- Re: use clausesDoctor Who
 `* Re: use clausesThomas
  `- Re: use clausesRandy Brukardt

1
use clauses

<62560a6b$0$18724$426a74cc@news.free.fr>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6824&group=comp.lang.ada#6824

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!cleanfeed1-a.proxad.net!nnrp1-2.free.fr!not-for-mail
From: fantome....@free.fr.invalid (Thomas)
Newsgroups: comp.lang.ada
Mail-Copies-To: nobody
Subject: use clauses
References: <607b56f8$0$3721$426a34cc@news.free.fr> <s5gq77$110s$1@gioia.aioe.org> <607bf826$0$3733$426a74cc@news.free.fr> <s5hnta$2qv$1@dont-email.me> <86im4hj6eh.fsf@stephe-leake.org> <s5n2nl$6ee$1@dont-email.me> <827fce15-8277-4ec8-a627-01158b42a191n@googlegroups.com> <s5nf6q$3c4$1@dont-email.me> <4205785c-6818-4e26-b931-5a775e2c426cn@googlegroups.com> <s5vqq9$lou$1@franka.jacob-sparre.dk>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
Date: Wed, 13 Apr 2022 01:25:31 +0200
Lines: 24
Message-ID: <62560a6b$0$18724$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 13 Apr 2022 01:25:32 CEST
NNTP-Posting-Host: 91.175.52.121
X-Trace: 1649805932 news-1.free.fr 18724 91.175.52.121:13907
X-Complaints-To: abuse@proxad.net
 by: Thomas - Tue, 12 Apr 2022 23:25 UTC

In article <s5vqq9$lou$1@franka.jacob-sparre.dk>,
"Randy Brukardt" <randy@rrsoftware.com> wrote:

> For me, a naming scheme that discourages the use of (package) use clauses is
> a bonus. (Such a scheme makes it easier to avoid use clauses.)

I agree to avoid use clauses.

(I personally prefer Lists.List, like Vincent Marciante -
i like Ada.Containers.* naming :-) )

> I personally
> only use "use type" in new code (there's tons of old code for which that
> doesn't work, of course, but that doesn't change the principle).

what do you think about:
- "use all type" clauses?
- List.Clear? (could you remember me how you call that, please?)
- List.Clear does work only if List is tagged?

--
RAPID maintainer
http://savannah.nongnu.org/projects/rapid/

Re: use clauses

<t357jt$v7n$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6825&group=comp.lang.ada#6825

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: use clauses
Date: Tue, 12 Apr 2022 20:05:00 -0500
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <t357jt$v7n$1@dont-email.me>
References: <607b56f8$0$3721$426a34cc@news.free.fr> <s5gq77$110s$1@gioia.aioe.org> <607bf826$0$3733$426a74cc@news.free.fr> <s5hnta$2qv$1@dont-email.me> <86im4hj6eh.fsf@stephe-leake.org> <s5n2nl$6ee$1@dont-email.me> <827fce15-8277-4ec8-a627-01158b42a191n@googlegroups.com> <s5nf6q$3c4$1@dont-email.me> <4205785c-6818-4e26-b931-5a775e2c426cn@googlegroups.com> <s5vqq9$lou$1@franka.jacob-sparre.dk> <62560a6b$0$18724$426a74cc@news.free.fr>
Injection-Date: Wed, 13 Apr 2022 01:05:02 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a863a4ac0777e526b7dfd040fe710118";
logging-data="31991"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZqpJotDm+Z5W5q4qIBrqUTx/reVZt4kU="
Cancel-Lock: sha1:cSZs144YRTIQF+2IUjPfBv2Vleg=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-RFC2646: Format=Flowed; Original
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-Priority: 3
X-MSMail-Priority: Normal
 by: Randy Brukardt - Wed, 13 Apr 2022 01:05 UTC

"Thomas" <fantome.forums.tDeContes@free.fr.invalid> wrote in message
news:62560a6b$0$18724$426a74cc@news.free.fr...
> In article <s5vqq9$lou$1@franka.jacob-sparre.dk>,
> "Randy Brukardt" <randy@rrsoftware.com> wrote:
>
>> For me, a naming scheme that discourages the use of (package) use clauses
>> is
>> a bonus. (Such a scheme makes it easier to avoid use clauses.)
>
> I agree to avoid use clauses.
>
> (I personally prefer Lists.List, like Vincent Marciante -
> i like Ada.Containers.* naming :-) )
>
>
>> I personally
>> only use "use type" in new code (there's tons of old code for which that
>> doesn't work, of course, but that doesn't change the principle).
>
> what do you think about:
> - "use all type" clauses?

This is OK; I don't use them mainly because I only use features implemented
in Janus/Ada, and "use all type" is not yet implemented there.

The fundamental problem with "use" is that it makes everything visible, and
then deals with conflicts by making those things invisible again. That's not
problem for overloadable primitive operations, since the profile is included
and conflicts only occur when someone has made a lousy design choice
(creating a routine with the same name and profile as a primitive) [Most
such conflicts come from maintenance when some existing routine is moved to
be primitive; in such cases, the original routine simply should be removed.]
Since "use all type" only works on overloadable primitives (and things that
work rather like primitives), it's fairly safe. One could make an argument
that primitive operations should always be visible when the type is (that's
not the Ada rule, but argubly it would work better in most circumstances) --
and you should always know to look at primitives anyway when trying to find
something..

> - List.Clear? (could you remember me how you call that, please?)

For tagged types, you can use prefix notation, so "My_List.Clear" is the
easiest. With "use all type List", you can write Clear(My_List). If your
objects have well-choosen names, it's not really needed to have the type
around for such operations, even when use clauses are in place. Thus,
"Clear", not "Clear_List", and that works well even when someone uses
everything in sight (of course, they may have a hard time finding where
Clear is defined when debugging, but that's their choice).

> - List.Clear does work only if List is tagged?

Right. There are a number of semantic issues for untagged types, the main
ones having to do with implicit dereference (which occurs in this notation,
as in any other selected_component notation). If you have a prefix of an
access type, it gets very messy to determine which dereference is which. And
just allowing composite types doesn't work well either: a private type that
is completed with an access type would *lose* operations when it had full
visibility -- that seems pretty weird.

It originally got limited to tagged types as that was easy to do and didn't
have semantic issues. We were going to look at generalizing the prefix
notation again (several people asked about it), but no one made a concrete
proposal and it never went anywhere for Ada 2022.

Randy.

Re: use clauses

<kvKdncavvLiLEcr_nZ2dnUU7-W3NnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6827&group=comp.lang.ada#6827

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!3.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 13 Apr 2022 21:51:02 -0500
Subject: Re: use clauses
Newsgroups: comp.lang.ada
References: <607b56f8$0$3721$426a34cc@news.free.fr>
<s5gq77$110s$1@gioia.aioe.org> <607bf826$0$3733$426a74cc@news.free.fr>
<s5hnta$2qv$1@dont-email.me> <86im4hj6eh.fsf@stephe-leake.org>
<s5n2nl$6ee$1@dont-email.me>
<827fce15-8277-4ec8-a627-01158b42a191n@googlegroups.com>
<s5nf6q$3c4$1@dont-email.me>
<4205785c-6818-4e26-b931-5a775e2c426cn@googlegroups.com>
<s5vqq9$lou$1@franka.jacob-sparre.dk>
<62560a6b$0$18724$426a74cc@news.free.fr> <t357jt$v7n$1@dont-email.me>
From: 25BZ...@nada.net (25.BX944)
Date: Wed, 13 Apr 2022 22:51:01 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <t357jt$v7n$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Message-ID: <kvKdncavvLiLEcr_nZ2dnUU7-W3NnZ2d@earthlink.com>
Lines: 14
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-tK7bs5iF1pN2ZgWiLZPTq7bMoG+XWUG/cp8lj1TYxt6NXFVU78xgm8FpqJUowJQdQHIUqCqpXpDTKaH!KZfifg9j4HMIu6pIKqM3leknIUND0UKuU+Zt8A/rvtr/5UdKtF43OTD1QSEl04BfiyHhktjHKwoi!yxfhp9FdDEt+o0SWu3M=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2118
 by: 25.BX944 - Thu, 14 Apr 2022 02:51 UTC

After fiddling around with ADA for awhile, I have concluded
that it's Just Not Worth It - too fiddly, TOO obsessed with
exact types and such. While there are SOME few justifications
for that, well, it's just pretty much UNUSABLE. If I need to
use an "old" language, well, FORTRAN is easier to deal with
and I actually *like* Pascal (I write lots of stuff in
Lazarus/FPC even today). And, of course, 'C' ...

So, unless you are somehow OBLIGATED, use something,
anything, but ADA.

Sorry, not what you wanted to hear, but ......

I will now de-subscribe.

Re: use clauses

<81bd7322-7f83-4733-86b7-c8c5b52abed3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6828&group=comp.lang.ada#6828

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:4455:b0:69c:6124:21fe with SMTP id w21-20020a05620a445500b0069c612421femr784538qkp.680.1649918953601;
Wed, 13 Apr 2022 23:49:13 -0700 (PDT)
X-Received: by 2002:a81:5309:0:b0:2e6:dcfc:8665 with SMTP id
h9-20020a815309000000b002e6dcfc8665mr856614ywb.501.1649918953358; Wed, 13 Apr
2022 23:49:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 13 Apr 2022 23:49:13 -0700 (PDT)
In-Reply-To: <kvKdncavvLiLEcr_nZ2dnUU7-W3NnZ2d@earthlink.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:6de2:76e3:b969:1036;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:6de2:76e3:b969:1036
References: <607b56f8$0$3721$426a34cc@news.free.fr> <s5gq77$110s$1@gioia.aioe.org>
<607bf826$0$3733$426a74cc@news.free.fr> <s5hnta$2qv$1@dont-email.me>
<86im4hj6eh.fsf@stephe-leake.org> <s5n2nl$6ee$1@dont-email.me>
<827fce15-8277-4ec8-a627-01158b42a191n@googlegroups.com> <s5nf6q$3c4$1@dont-email.me>
<4205785c-6818-4e26-b931-5a775e2c426cn@googlegroups.com> <s5vqq9$lou$1@franka.jacob-sparre.dk>
<62560a6b$0$18724$426a74cc@news.free.fr> <t357jt$v7n$1@dont-email.me> <kvKdncavvLiLEcr_nZ2dnUU7-W3NnZ2d@earthlink.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <81bd7322-7f83-4733-86b7-c8c5b52abed3n@googlegroups.com>
Subject: Re: use clauses
From: briot.em...@gmail.com (Emmanuel Briot)
Injection-Date: Thu, 14 Apr 2022 06:49:13 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 4
 by: Emmanuel Briot - Thu, 14 Apr 2022 06:49 UTC

On Thursday, April 14, 2022 at 4:51:10 AM UTC+2, 25.BX944 wrote:
> So, unless you are somehow OBLIGATED, use something,
> anything, but ADA.

I fully understand. Can I recommend that you try Whitespace (https://en.wikipedia.org/wiki/Whitespace_(programming_language)) or Basic as your language of choice ? They should not be as bothersome as Ada. Of course, the surprises come at run time !

Re: use clauses

<ir0i5h1ps9pc4ri8lg8glhab0phlrts6cp@4ax.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6829&group=comp.lang.ada#6829

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: doc...@tardis.org (Doctor Who)
Newsgroups: comp.lang.ada
Subject: Re: use clauses
Date: Fri, 15 Apr 2022 07:33:07 +0200
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <ir0i5h1ps9pc4ri8lg8glhab0phlrts6cp@4ax.com>
References: <s5gq77$110s$1@gioia.aioe.org> <607bf826$0$3733$426a74cc@news.free.fr> <s5hnta$2qv$1@dont-email.me> <86im4hj6eh.fsf@stephe-leake.org> <s5n2nl$6ee$1@dont-email.me> <827fce15-8277-4ec8-a627-01158b42a191n@googlegroups.com> <s5nf6q$3c4$1@dont-email.me> <4205785c-6818-4e26-b931-5a775e2c426cn@googlegroups.com> <s5vqq9$lou$1@franka.jacob-sparre.dk> <62560a6b$0$18724$426a74cc@news.free.fr> <t357jt$v7n$1@dont-email.me> <kvKdncavvLiLEcr_nZ2dnUU7-W3NnZ2d@earthlink.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6631a11706bc6f61d622239becd92d37";
logging-data="32763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/h20TRotTd2DelCFswRbLl"
User-Agent: ForteAgent/8.00.32.1272
Cancel-Lock: sha1:D1nSwG/oOrBm+si/5clLwk2fdpw=
 by: Doctor Who - Fri, 15 Apr 2022 05:33 UTC

On Wed, 13 Apr 2022 22:51:01 -0400, "25.BX944" <25BZ494@nada.net>
wrote:

>After fiddling around with ADA for awhile, I have concluded
>that it's Just Not Worth It - too fiddly, TOO obsessed with
>exact types and such. While there are SOME few justifications
>for that, well, it's just pretty much UNUSABLE. If I need to
>use an "old" language, well, FORTRAN is easier to deal with
>and I actually *like* Pascal (I write lots of stuff in
>Lazarus/FPC even today). And, of course, 'C' ...
>
>So, unless you are somehow OBLIGATED, use something,
>anything, but ADA.
>
>Sorry, not what you wanted to hear, but ......
>
>I will now de-subscribe.

you are not a programmer.

Re: use clauses

<625e324c$0$18369$426a34cc@news.free.fr>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6842&group=comp.lang.ada#6842

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed1-b.proxad.net!nnrp2-2.free.fr!not-for-mail
From: fantome....@free.fr.invalid (Thomas)
Newsgroups: comp.lang.ada
Mail-Copies-To: nobody
Subject: Re: use clauses
References: <607b56f8$0$3721$426a34cc@news.free.fr> <s5gq77$110s$1@gioia.aioe.org> <607bf826$0$3733$426a74cc@news.free.fr> <s5hnta$2qv$1@dont-email.me> <86im4hj6eh.fsf@stephe-leake.org> <s5n2nl$6ee$1@dont-email.me> <827fce15-8277-4ec8-a627-01158b42a191n@googlegroups.com> <s5nf6q$3c4$1@dont-email.me> <4205785c-6818-4e26-b931-5a775e2c426cn@googlegroups.com> <s5vqq9$lou$1@franka.jacob-sparre.dk> <62560a6b$0$18724$426a74cc@news.free.fr> <t357jt$v7n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
Date: Tue, 19 Apr 2022 05:53:47 +0200
Lines: 104
Message-ID: <625e324c$0$18369$426a34cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 19 Apr 2022 05:53:48 CEST
NNTP-Posting-Host: 91.175.52.121
X-Trace: 1650340428 news-4.free.fr 18369 91.175.52.121:8270
X-Complaints-To: abuse@proxad.net
 by: Thomas - Tue, 19 Apr 2022 03:53 UTC

In article <t357jt$v7n$1@dont-email.me>,
"Randy Brukardt" <randy@rrsoftware.com> wrote:

> "Thomas" <fantome.forums.tDeContes@free.fr.invalid> wrote in message
> news:62560a6b$0$18724$426a74cc@news.free.fr...
> > In article <s5vqq9$lou$1@franka.jacob-sparre.dk>,
> > "Randy Brukardt" <randy@rrsoftware.com> wrote:
> >
> >> I personally
> >> only use "use type" in new code (there's tons of old code for which that
> >> doesn't work, of course, but that doesn't change the principle).
> >
> > what do you think about:
> > - "use all type" clauses?
>
> This is OK; I don't use them mainly because I only use features implemented
> in Janus/Ada, and "use all type" is not yet implemented there.
>
> The fundamental problem with "use" is that it makes everything visible, and
> then deals with conflicts by making those things invisible again.

> Since "use all type" only works on overloadable primitives (and things that
> work rather like primitives), it's fairly safe. One could make an argument
> that primitive operations should always be visible when the type is (that's
> not the Ada rule, but argubly it would work better in most circumstances) --
> and you should always know to look at primitives anyway when trying to find
> something..

are you speaking about a case like Ada.Text_IO.Unbounded_IO?
i would say that these subprograms are not primitives, since they are
not declared in the same package,
and i don't see in which case we could get a type visible but not its
primitives.

in this case, the best thing to do that i found is:
use all type Ada.Text_IO.File_Type;
use Ada.Text_IO.Unbounded_IO;
is there sth best?

BTW, i often get a repetition in the same declare bloc, like:
File : Ada.Text_IO.File_Type;
use all type Ada.Text_IO.File_Type;

what do you think about generate an automatic "use all type" where the
variable is declared?

>
> > - List.Clear? (could you remember me how you call that, please?)
>
> For tagged types, you can use prefix notation, so "My_List.Clear" is the
> easiest. With "use all type List", you can write Clear(My_List).

i asked for your opinion, because J-P. Rosen told me he doesn't like
that. so i would like to know main usages, practicals, ...

if i got it, you use prefix notation a lot, because you have no access
to "use all type"?

> ["Clear" works well even when someone uses
> everything in sight] (of course, they may have a hard time finding where
> Clear is defined when debugging, but that's their choice).

are you sure?
i would say either there is only 1 Clear for the type List, and if it's
a primitive it's easy to know where to find it, or there are many Clear
for the type List, and they are not visibles.

>
> > - List.Clear does work only if List is tagged?
>
> Right. There are a number of semantic issues for untagged types, the main
> ones having to do with implicit dereference (which occurs in this notation,
> as in any other selected_component notation). If you have a prefix of an
> access type, it gets very messy to determine which dereference is which. And
> just allowing composite types doesn't work well either: a private type that
> is completed with an access type would *lose* operations when it had full
> visibility -- that seems pretty weird.
>
> It originally got limited to tagged types as that was easy to do and didn't
> have semantic issues.

what's i don't understand is, there is sth which work better with tagged
types than with untagged types, whereas tagged types are known to be
more complex to give special functionnality, not to be simpler to use.

could you give me a concrete example please, of a case where using
prefix notation with an untagged type causes a particular problem, and
then making the type tagged permits to resolve the problem?

> We were going to look at generalizing the prefix
> notation again (several people asked about it), but no one made a concrete
> proposal and it never went anywhere for Ada 2022.

(maybe i could make one if i understand enough? :-) )

--
RAPID maintainer
http://savannah.nongnu.org/projects/rapid/

Re: use clauses

<t3lj44$fh5$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6843&group=comp.lang.ada#6843

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: use clauses
Date: Tue, 19 Apr 2022 00:59:31 -0500
Organization: A noiseless patient Spider
Lines: 181
Message-ID: <t3lj44$fh5$1@dont-email.me>
References: <607b56f8$0$3721$426a34cc@news.free.fr> <s5gq77$110s$1@gioia.aioe.org> <607bf826$0$3733$426a74cc@news.free.fr> <s5hnta$2qv$1@dont-email.me> <86im4hj6eh.fsf@stephe-leake.org> <s5n2nl$6ee$1@dont-email.me> <827fce15-8277-4ec8-a627-01158b42a191n@googlegroups.com> <s5nf6q$3c4$1@dont-email.me> <4205785c-6818-4e26-b931-5a775e2c426cn@googlegroups.com> <s5vqq9$lou$1@franka.jacob-sparre.dk> <62560a6b$0$18724$426a74cc@news.free.fr> <t357jt$v7n$1@dont-email.me> <625e324c$0$18369$426a34cc@news.free.fr>
Injection-Date: Tue, 19 Apr 2022 05:59:32 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2d4822fc64eedba82495d555d0e17991";
logging-data="15909"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GTfvuoCcs9mGK7pkSfGI5kK6BRkMgZTE="
Cancel-Lock: sha1:2/J9HeptXB6RRJ0lPHQBoqO30NY=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-RFC2646: Format=Flowed; Original
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-Priority: 3
X-MSMail-Priority: Normal
 by: Randy Brukardt - Tue, 19 Apr 2022 05:59 UTC

"Thomas" <fantome.forums.tDeContes@free.fr.invalid> wrote in message
news:625e324c$0$18369$426a34cc@news.free.fr...
> In article <t357jt$v7n$1@dont-email.me>,
> "Randy Brukardt" <randy@rrsoftware.com> wrote:
>
>> "Thomas" <fantome.forums.tDeContes@free.fr.invalid> wrote in message
>> news:62560a6b$0$18724$426a74cc@news.free.fr...
>> > In article <s5vqq9$lou$1@franka.jacob-sparre.dk>,
>> > "Randy Brukardt" <randy@rrsoftware.com> wrote:
>> >
>> >> I personally
>> >> only use "use type" in new code (there's tons of old code for which
>> >> that
>> >> doesn't work, of course, but that doesn't change the principle).
>> >
>> > what do you think about:
>> > - "use all type" clauses?
>>
>> This is OK; I don't use them mainly because I only use features
>> implemented
>> in Janus/Ada, and "use all type" is not yet implemented there.
>>
>> The fundamental problem with "use" is that it makes everything visible,
>> and
>> then deals with conflicts by making those things invisible again.
>
>
>> Since "use all type" only works on overloadable primitives (and things
>> that
>> work rather like primitives), it's fairly safe. One could make an
>> argument
>> that primitive operations should always be visible when the type is
>> (that's
>> not the Ada rule, but argubly it would work better in most
>> circumstances) --
>> and you should always know to look at primitives anyway when trying to
>> find
>> something..
>
> are you speaking about a case like Ada.Text_IO.Unbounded_IO?

No, I was thinking more about typical ADTs (abstract data types), which
usually come with most of their operations in a package. The containers,
Text_IO, and Claw are all examples. Operations in packages like this are the
ones that "use all type" make visible, and that's OK because that's where
you would look for operations on the type anyway.

> i would say that these subprograms are not primitives, since they are
> not declared in the same package,

Correct.

> and i don't see in which case we could get a type visible but not its
> primitives.

The primitives and type are visible, but not directly visible (I hate that
terminology). Which means you can use them with full names, but not
directly. For types, I almost always use the full name anyway (since they
aren't referenced that much). So if you have an object:

Fyle : Ada.Text_IO.File_Type;

the type is visible (but not directly visible). It's annoying that you have
to jump thru hoops (such as "use all type") in order to get them. Operators
in particular should always work so long as the type is visible (even if not
directly visible). But that would require restricting where they are
declared, and it's too late to do that for Ada.

> in this case, the best thing to do that i found is:
> use all type Ada.Text_IO.File_Type;
> use Ada.Text_IO.Unbounded_IO;
> is there sth best?

I just write out such things.

Ada.Text_IO.Unbounded_IO.Put (My_String);

If I had to use a lot of them in some code, I'd probably use a local rename.
It's not great, but at least you can figure out where the thing is declared
without having some giant IDE running all the time..

> BTW, i often get a repetition in the same declare bloc, like:
> File : Ada.Text_IO.File_Type;
> use all type Ada.Text_IO.File_Type;

Yup.

> what do you think about generate an automatic "use all type" where the
> variable is declared?

For tagged objects, you already have it effectively with prefix notation.
And who cares about antique stuff?? :-)

>> > - List.Clear? (could you remember me how you call that, please?)
>>
>> For tagged types, you can use prefix notation, so "My_List.Clear" is the
>> easiest. With "use all type List", you can write Clear(My_List).
>
> i asked for your opinion, because J-P. Rosen told me he doesn't like
> that. so i would like to know main usages, practicals, ...
>
> if i got it, you use prefix notation a lot, because you have no access
> to "use all type"?

Nope: Janus/Ada doesn't implement that yet, either (it was an Ada 2005
feature). I personally write a lot of long-winded identifiers:

Foobar (UString => Ada.Strings.Unbounded.To_Unbounded_String
(My_Package.Data_Selector (Glarch, 3));

(Although that one often gets a special rename:

function "+" (A : in String) return
Ada.Strings.Unbounded.Unbounded_String renames
Ada.Strings.Unbounded.To_Unbounded_String;

and then:

Foobar (UString => + My_Package.Data_Selector (Glarch, 3));

I'd rather not do that, but this one gets to be too much... :-)

>> ["Clear" works well even when someone uses
>> everything in sight] (of course, they may have a hard time finding where
>> Clear is defined when debugging, but that's their choice).
>
> are you sure?
> i would say either there is only 1 Clear for the type List, and if it's
> a primitive it's easy to know where to find it, or there are many Clear
> for the type List, and they are not visibles.

The usual problem is that they didn't name their objects very well and thus
don't know the type. Or it's maintenance and you don't know the code well
enough to know the type. Or it's 40 years later and you've forgotten
everything you knew about the code (my situation with Janus/Ada code :-). If
you don't know the type or know where it it declared, it's hard to know
where to look for primitives. And not all code is organized as ADTs
(especially true in older code), so there may not be a lot of primitives.

>> > - List.Clear does work only if List is tagged?
>>
>> Right. There are a number of semantic issues for untagged types, the main
>> ones having to do with implicit dereference (which occurs in this
>> notation,
>> as in any other selected_component notation). If you have a prefix of an
>> access type, it gets very messy to determine which dereference is which.
>> And
>> just allowing composite types doesn't work well either: a private type
>> that
>> is completed with an access type would *lose* operations when it had full
>> visibility -- that seems pretty weird.
>>
>> It originally got limited to tagged types as that was easy to do and
>> didn't
>> have semantic issues.
>
> what's i don't understand is, there is sth which work better with tagged
> types than with untagged types, whereas tagged types are known to be
> more complex to give special functionnality, not to be simpler to use.
>
> could you give me a concrete example please, of a case where using
> prefix notation with an untagged type causes a particular problem, and
> then making the type tagged permits to resolve the problem?

Go read the AIs, I would have to do that to find the details, and I'd
probably transcribe it wrong. The last discussion was in AI12-0257-1. (I
looked that up in the AI index - see
http://www.ada-auth.org/AI12-VOTING.HTML for the Ada 2012 one.)

>> We were going to look at generalizing the prefix
>> notation again (several people asked about it), but no one made a
>> concrete
>> proposal and it never went anywhere for Ada 2022.
>
> (maybe i could make one if i understand enough? :-) )

That's a big if! :-)

Randy.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor