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 X-Received: by 10.43.149.193 with SMTP id kl1mr8892557icc.5.1406768443509; Wed, 30 Jul 2014 18:00:43 -0700 (PDT) X-Received: by 10.182.20.104 with SMTP id m8mr42864obe.11.1406768443387; Wed, 30 Jul 2014 18:00:43 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h18no6749973igc.0!news-out.google.com!px9ni1igc.0!nntp.google.com!h18no6749963igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 30 Jul 2014 18:00:43 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=73.179.102.101; posting-account=wEPvUgoAAABrLeiz_LRhQ3jeEhyfWVMH NNTP-Posting-Host: 73.179.102.101 References: <166aaec5-5e9c-40e0-9b07-9b9c7d5f7f33@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <16a6846f-2964-438a-ab9b-2029075f7924@googlegroups.com> Subject: Re: Quick question regarding limited type return syntax From: NiGHTS Injection-Date: Thu, 31 Jul 2014 01:00:43 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:21362 Date: 2014-07-30T18:00:43-07:00 List-Id: On Wednesday, July 30, 2014 8:48:34 PM UTC-4, Shark8 wrote: > On 30-Jul-14 17:51, NiGHTS wrote: > > > return Object (Connection_String'Access) do null; end return; > > > > That should be > > return Object'(Connection_String'Access); > > the extended-return is the form > > return object:type [:= value] do > > sequence_of_statements > > end return; > > > > as you can see there's no 'do' there -- which is what the compiler was > > complaining about: there was no ';' between the value and "do". > > > > > return Object (Connection_String'Access); > > > > The reason this is failing is because it's reading the parens as > > conversion, not qualification -- for qualification you need a "'"; > > personally I'm a fan of using named parameters when using qualification > > and generating objects. > > > > return Object'(Parameters => Connection_String'Access, others => <>); This was another syntax I had tried. Here is the error I am getting with your syntax: Expected type "Object" defined at (...) Found type access to subtype of "Standard.String" at line (...) Just to be clear this is my modification: package body Test is function Create(...) return Object is ... begin return Object'(Connection_String'Access); end; ... end Test;