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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!watmath!clyde!att!rutgers!mit-eddie!uw-beaver!cornell!batcomputer!itsgw!steinmetz!uunet!mcvax!enea!sommar From: sommar@enea.se (Erland Sommarskog) Newsgroups: comp.lang.ada Subject: Re: limited private types Message-ID: <4126@enea.se> Date: 3 Dec 88 23:10:54 GMT Organization: ENEA DATA AB, Sweden List-Id: Ron Guilmette (rfg@nsc.nsc.com.UUCP) wants to be able to defer the implementation of a (limited) private type to the body of his package. He writes: >Anyway, I *do* know about the special tricky Ada rule which allows you >to defer a full type definition until the corresponding package body >... >Basically, about the only thing you can do with such objects is to pass >them as actual parameters to subprograms. Obviously, if you do this, then >for each such subprogram, the actual *definition* of the given subprogram >must be compiled only *after* the full type declaration has already been >compiled. >... >Since any given Ada compiler must generate code to copy scalar actual >parameters into their corresponding formals, and since the most efficient >... Since you have thought so much on the not-so-obvious problem of parameter passing, you must have found the answer to the more obvious problem of heap and stack allocation as trivial. I am probably stupid, because I fail to see any attractive solutions to that. If in my block I declare: A : A_limited_type; B : Another_limited; C : ARRAY(1..20) OF Yet_another_limited; If the implementation of the types in available in the specification of the types originating package, there is no problem. But if you defer them to the body, and do not allow cheating with pointers? Enlighten me, how to you allocate them on the stack? Implicit pointers? Some implicit size-telling function called at run-time? Not very attractive, since the place on the stack for other local variables is dependent of the size of the types. To be straight I think that the pointer "trick" serves our needs perfectly here, and that your proposal is just YAUAC. (Yet Another Unnecessary Ada Change.) -- Erland Sommarskog ENEA Data, Stockholm sommar@enea.se "Frequently, unexpected errors are entirely unpredictable" - Digital Equipment