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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fa18fb47ddd229a7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-10 10:47:57 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!cs.tu-berlin.de!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Proposed change to BC iterator parameters [limitedness] Date: Wed, 10 Dec 2003 18:47:56 +0000 (UTC) Organization: GMUGHDU Message-ID: References: NNTP-Posting-Host: l1-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1071082076 7462 134.91.1.34 (10 Dec 2003 18:47:56 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Wed, 10 Dec 2003 18:47:56 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/800)) Xref: archiver1.google.com comp.lang.ada:3326 Date: 2003-12-10T18:47:56+00:00 List-Id: amado.alves wrote: : <> : : I think there are (container) libraries that accept limited element types. Charles does (some of it). : And some libs that dont can easily (?) be changed : in that direction. But as I indicated I think it is 'unatural' : to store values of a limited type. For me it does not make sense : to put constants in a container. So my advice can only be: rethink : your program. I tried, limitedness is only an implication of having access discriminants in tagged types, which fulfil the requirements (see type T below): - "There are three constant links to other objects in these objects". - "You will have to provide initial values for these links, we cannot have dangling pointers here.". given type T (look_here: access D; look_there: access E; and_also_over_there: access D) is tagged limited record variable_part_1: Some_Type; variable_part_2: Some_Other_Type; end record; ... The thing is not that I want to store constant instances of T, I will have to have instances available with both constant component parts and variable component parts, as above. To me, this type seemed natural. Or is it not, given the requirements from above? Where do I store these instances? They must live somewhere... The "solutions" I have now are using a _comment_ indicating that clients _should_ use a constructor function, here is one of the solutions that doesn't use pointers to T objects: type T is tagged private; -- use make! function make (look_here: D; look_there: E; and_also_over_there: D) return T; where the full view of T contains pointer fields, and make provides '(unchecked)_access values for them. But "-- use make!" is not enforcable by a compiler, while type T(<>) is tagged limited private; or some such will not allow me or anyone else to declare T objects without initialisation (for any access parameters). Which is what I found desirable, I can then rely on the language and assume that T instances will have been initialised, without relying on programmers obeying a comment about a related function. I'm stuck. (Thinking around corners: deriving a definite T from Controlled inside a generic wich has make(...) from above as a formal subprogram wich is then called during Initialise of T? Phew...) -- Georg