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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada Successor Language Date: Fri, 22 Jun 2018 17:49:22 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <5e86db65-84b9-4b5b-9aea-427a658b5ae7@googlegroups.com> <878t7u1cfm.fsf@nightsong.com> <776f3645-ed0c-4118-9b4d-21660e3bba4b@googlegroups.com> <87602fbu2g.fsf@nightsong.com> <87po0mziqt.fsf@nightsong.com> <30e271d8-0ef9-4986-8726-2b09c7fb9526@googlegroups.com> <9c30a174-9fdc-47ce-be34-338223c07735@googlegroups.com> NNTP-Posting-Host: 3CrKQyqWAJZHy6zYVP/kUg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:53253 Date: 2018-06-22T17:49:22+02:00 List-Id: On 2018-06-22 17:18, Dan'l Miller wrote: > On Wednesday, June 20, 2018 at 2:33:26 AM UTC-5, Dmitry A. Kazakov wrote: >> On 2018-06-19 23:07, Dan'l Miller wrote: >>> On Tuesday, June 19, 2018 at 2:39:30 PM UTC-5, Dmitry A. Kazakov wrote: >>>> On 2018-06-19 21:19, Paul Rubin wrote: >>>>> "Dmitry A. Kazakov" writes: >>>>>> There are 50 shades of mess. Ada's generics try to introduce some >>>>>> weakly-typed contracts on the formal generic parameters, where C++ >>>>>> templates go completely untyped, but mess is always mess. You cannot >>>>>> make a decent language out of macro processor. >>>>> >>>>> I don't understand what you're getting at. Are Ada generics implemented >>>>> with a macro processor? C++ templates amount to that, but there are >>>>> other, better ways to implement generics. >>>> >>>> Generics and macros are same thing regardless implementation. The core >>>> idea and all power lies in textual substitution as opposed to the >>>> concept substitutability in a properly typed systems. >>> >>> Clearly, Ada's generics are not performing textual substitution. Ada's generics are performing >> restriction-matching on subtypes passed as formal arguments. If the criteria of the restrictions are >> satisfied, the previously-declared-long-ago subtype in the AST is what is passed in as the formal >> argument of an Ada generic. >> >> There is no such thing in Ada. > > No such thing? Exactly so. Ada subtypes are equivalent, there is no way to accept Positive and reject Negative in most context, generic formals included. > generic > type My_Element is private; > with package Sets is new Set_Signature(Element => My_Element, others => <>); > > overriding > procedure This is new That( ... ); > > All these {T1, Ancestor, LT, TLT, A, Set_Signature, Element, That} are the restrictions that, if absent, cause the generic package to fail to compile. So, yes, there most certainly is such a thing in Ada. Yes. Things you mentioned are not Ada-subtype constraints. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de