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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,183a4dcac8cf6632 X-Google-Attributes: gid103376,public From: dgibson@thalamus.cis.ohio-state.edu (david scott gibson) Subject: Re: Q: on redefinition of equal Date: 1996/04/05 Message-ID: <4k3qurINN33k@thalamus.cis.ohio-state.edu>#1/1 X-Deja-AN: 145986107 references: <9604031559.AA05644@most> <4k131kINN2ac@thalamus.cis.ohio-state.edu> organization: The Ohio State University, Department of Computer and Information Science newsgroups: comp.lang.ada Date: 1996-04-05T00:00:00+00:00 List-Id: In article , Brad Balfour wrote: >In article <4k131kINN2ac@thalamus.cis.ohio-state.edu>, >dgibson@thalamus.cis.ohio-state.edu (david scott gibson) wrote: > >>If I wanted to modify the compiler, all I'd need to do is change the >>Normalize_Scalars pragma to initialize all scalars with valid >>representations. > >Perhaps I've missed something in all of the preceeding articles, but is >all of your work to overload Booalean and the associated operations is in >order to detected unitialized variables which contain "invalid" bit >patterns? No. I discussed my problems with scalars on cla a few months ago, it wasn't part of this thread. In order to map the RESOLVE language to Ada95, I need all variables, including those of generic formal types, initialized to a specified value of their type at the beginning of their scope. This is done in RESOLVE to support verifiability, efficient implementations using swap, and, indirectly, composability. For scalars, I can get away with an "unknown" initial value as long as it is a valid representation. In RESOLVE/Ada, generic package operations may manipulate a generic initial-valued object without regard to its actual (but valid) representation. For nearly all non-scalar types, I must use Initialize and Finalize calls, and thus my heavy use of controlled types. In order to perform constant-time swapping on all types, most type representations in RESOLVE/Ada must be dynamically allocated. A yet unproven hypothesis is that the improved efficiency that can result from using swapping (instead of copying) will overcome the added indirection overhead necessary in an Ada95 implementation of RESOLVE. (Results with RESOLVE/C++ are encouraging.) >If so, is there a reason that you aren't using the 'valid attribute? There might be some way I could make use of the 'valid attribute, but if so, I suspect that it would be very messy. The problem occurs when I declare a local variable of a generic formal type which could, in general, be instantiated with a scalar type. In RESOLVE, it is common to immediately Swap an (initial valued) local variable with one of the operation's parameters. In Ada, if the local variable value is not a valid representation, then I believe the call to Swap could raise a Program_Error. To make use of 'valid, I would have to check every locally declared variable of a generic formal type before using it. Then if the representation were invalid, I might be able to somehow correctly initialize it to a scalar value. No, this seems a bit far fetched and probably wouldn't yield a performance improvement anyway. Thanks very much for the suggestion! -- Dave dgibson@cis.ohio-state.edu