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.42.207.146 with SMTP id fy18mr8378124icb.12.1406764270631; Wed, 30 Jul 2014 16:51:10 -0700 (PDT) X-Received: by 10.182.102.168 with SMTP id fp8mr447obb.28.1406764270292; Wed, 30 Jul 2014 16:51:10 -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!h18no6725392igc.0!news-out.google.com!eg1ni356igc.0!nntp.google.com!v10no3449536qac.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 30 Jul 2014 16:51:10 -0700 (PDT) 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 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <166aaec5-5e9c-40e0-9b07-9b9c7d5f7f33@googlegroups.com> Subject: Quick question regarding limited type return syntax From: NiGHTS Injection-Date: Wed, 30 Jul 2014 23:51:10 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:21357 Date: 2014-07-30T16:51:10-07:00 List-Id: I am designing a package which features a "Create" function that returns a = newly instantiated "Object" which is a discriminated limited type. The code= compiles and operates correctly but gives me a warning that "New_Object" i= s not used. See below (ellipses represent omitted code): ----- package Test is type Object (Parameters : access String) is tagged limited private; function Create (...) return Object; ... private type Object (Parameters : access String) is tagged limited record Database : PQ.Database (Parameters); ... end record; ... end Test; package body Test is function Create(...) return Object is ... begin return New_Object : Object (Connection_String'Access) do=20 null; end return; end; ... end Test; ----- To remove this warning I've tried this: return Object (Connection_String'Access) do null; end return; and it gives an error about expecting a ';'. I've also tried this: return Object (Connection_String'Access); Compiler tells me "argument of conversion cannot be access".=20 I have tried other syntax variants but all produce errors. My goal here is = to avoid using "new" which is why I am trying to return the instance in thi= s way. How can I rewrite this code so that I won't get any errors or warnings?