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: limited agregate and limited components default initialization Date: Sun, 1 Apr 2018 22:42:48 -0500 Organization: JSA Research & Innovation Message-ID: References: <29943b13-00d1-443a-82f2-f55272770109@googlegroups.com> Injection-Date: Mon, 2 Apr 2018 03:42:49 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="23533"; 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; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:51289 Date: 2018-04-01T22:42:48-05:00 List-Id: "Jean-Claude Rostaing" <00120260a@gmail.com> wrote in message news:29943b13-00d1-443a-82f2-f55272770109@googlegroups.com... > the smart pointer is NOT limited, but ITEM_TYPE is. Simply because I want > to accept as many type as possible. > > generic > type Item_type(<>) is limited private; > package Pointers is > type Accessor_type(Data: not null access Item_type) is limited private > with Implicit_Dereference => Data; > type Smart_Pointers(<>) is private; > NULL_ACCESS: Constant Smart_Pointers; > > I could ask a constructor as a parameter, but it would be stupid since > clients whou would want to instanciate with a limited type, won'obviously > wouldn't be able to provide a constructor. > > I'm waiting for a solution... Randy the savior ? A limited type can have a constructor function -- it just has to really construct the type, not copy it as you are doing in your examples. It won't work to solve *every* problem, but it will solve most. (Dmitry is a little too pessimistic in his assessment.) Randy.