From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.19.78 with SMTP id 75mr13040414itz.0.1517063509689; Sat, 27 Jan 2018 06:31:49 -0800 (PST) X-Received: by 10.157.1.193 with SMTP id e59mr1197709ote.13.1517063509585; Sat, 27 Jan 2018 06:31:49 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!g80no155203itg.0!news-out.google.com!b73ni595ita.0!nntp.google.com!w142no156850ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 27 Jan 2018 06:31:49 -0800 (PST) In-Reply-To: <8a75d56c-29d0-464a-9f2a-9126d8f17ba1@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.208.22; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.208.22 References: <61ba3677-0041-4dba-af9b-a5df48f3ce8a@googlegroups.com> <6427a793-91a4-4feb-b067-ed89b4c04421@googlegroups.com> <3af9cfc4-d434-4d60-a4ed-17a16f75717f@googlegroups.com> <36f3a79b-0db5-4199-9a7a-cbf64058cd18@googlegroups.com> <8a75d56c-29d0-464a-9f2a-9126d8f17ba1@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Iterable container as generic parameter From: Jere Injection-Date: Sat, 27 Jan 2018 14:31:49 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3953 X-Received-Body-CRC: 1756103625 Xref: reader02.eternal-september.org comp.lang.ada:50181 Date: 2018-01-27T06:31:49-08:00 List-Id: On Saturday, January 27, 2018 at 6:38:43 AM UTC-5, Lionel Draghi wrote: > Le samedi 27 janvier 2018 08:03:49 UTC+1, Randy Brukardt a =C3=A9crit=C2= =A0: > > ... > > >By the way, I have another question. There is no way to provide a defa= ult > > > instantiation to a formal package parameter? > >=20 > > Not in Ada 2012 or before. There is an open issue (it is one of those t= hat=20 > > Emmanuel referenced in his message) to allow that. It hasn't progressed= any=20 > > significant amount at this time. >=20 > Very interesting indeed, to have lawyers and implementers view on a langu= age change proposal. >=20 > From my user point of view, the "or use" proposal looks very good. > It's simple (to write!), easy to read (much more in my opinion than "with= Default_Type =3D> ..." syntax). I agree. I like the "or use" syntax best so far. >=20 > I would just add that, when reading the comment on the ":=3D" proposal, t= hat ":=3D" may seems to imply copying a type, I realized that I was already= reading : > > procedure New_Line (Spacing : Positive_Count :=3D 1); > as "give your own spacing, _or use_ 1 if none given", and not as=20 > "_copy_ 1 in Spacing if none given".=20 >=20 > So, IMHO, I wouldn't give a high weight to this argument. > =20 > And, actually,=20 > > procedure New_Line (Spacing : Positive_Count or use 1); > looks good too :-) > =20 While I don't like :=3D as much as "or use", I will just add that in today's Ada, :=3D doesn't always imply copying. It also can imply build in place (somewhat similar to move semantics) in some cases. So I agree that it isn't as much of a stretch. I would still think "or use" is better though. Another option that is less useful than default package types is (making up a term here) package delegation/forwarding: -- not legal Ada with Specific_Package; use Specific_Package; generic type Some_Type is limited private; package Default_Package is new Base_Package (First_Param =3D> Specific_Thing, Second_Param =3D> Some_Type); I think you can do that or something similar in a generic formal, but I don't think you can define a new generic like this. It would only be an alternative to default package formals (I would prefer those), but would allow for defining a default package specification for another. It wouldn't be very useful if you wanted to default a lot of things in different combinations though.