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!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Strings with discriminated records Date: Wed, 30 May 2018 14:48:43 -0500 Organization: JSA Research & Innovation Message-ID: References: <55ce14eb-6b83-4ea0-a550-f9e1410d0b06@googlegroups.com> <06a59646-1d72-4200-967b-592ab61c4b1f@googlegroups.com> Injection-Date: Wed, 30 May 2018 19:48:55 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="2037"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:52789 Date: 2018-05-30T14:48:43-05:00 List-Id: BTW, the reason that I said "it might change" is that there are some issues with what to do with private types where the full type "naturally" has the same kind of literal. I don't think that is handled quite right yet, and it's relatively important to get right (user-defined aggregates have a similar, even worse problem). Randy. "Randy Brukardt" wrote in message news:pemv2c$1uq$1@franka.jacob-sparre.dk... > "Mehdi Saada" <00120260a@gmail.com> wrote in message > news:06a59646-1d72-4200-967b-592ab61c4b1f@googlegroups.com... >>> M : Message := "Hello World"; >> >>>Or you could just give string literals to type Message (although you'll >>>have >> to wait a bit for that capability -- but it should be in Ada 2020 - >> finally). >> I don't get what you mean exactly (meaning of "give"). What would it look >> like ? >> Would it be something like >> type Message (discriminants or not) is ... end record with IS_LIKE => >> String ? > > See AI12-0249-1. This hasn't been discussed at a meeting yet, so it > probably will change some, but Tucker suggests aspects "Integer_Literal", > "Real_Literal", "Null_Literal", and "String_Literal". These represent > functions that can be specified: > > type Message (discriminants or not) is ... end record > with String_Literal => Make_Message; > > where Make_Message is something like: > > function Make_Message (Lit : in Wide_Wide_String) return Message; > > with the obvious semantics when a string literal is encountered. > > Randy. > >