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,e91f674b5db5e2b2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-18 01:16:53 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!212.177.105.133!news.mailgate.org!zur.uu.net!ash.uu.net!spool0900.news.uu.net!news0-alterdial.eu.uu.net!not-for-mail From: Juanma Barranquero Newsgroups: comp.lang.ada Subject: Re: Assigning the value of a deferred constant? Date: Tue, 18 Sep 2001 10:16:51 +0200 Message-ID: References: <7a2cqtcole1v0038jiorf4ncdant1fs3im@4ax.com> <9wqp7.16899$L%5.13832570@news1.rdc1.sfba.home.com> X-Newsreader: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 62.22.27.143 X-Trace: news0-alterdial.eu.uu.net 1000801011 24948 62.22.27.143 Xref: archiver1.google.com comp.lang.ada:13141 Date: 2001-09-18T10:16:51+02:00 List-Id: On Mon, 17 Sep 2001 17:36:05 GMT, tmoran@acm.org wrote: > You can't elaborate the body before you're done elaborating the >spec, but you can elaborate a different package, including its body. Yes, that's a solution, but still it is strange to be forced to use another package just to initialize the constant. After all, it is not (entirely) a matter of elaboration. If in my example I do: package Test is pragma Elaborate_Body(Test); type Byte_Order is (Little_Endian, Big_Endian); Default_Byte_Order : Byte_Order; end Test; package body Test is -- whatever begin -- Default_Byte_Order assigned here end Test; i.e., I substitute a variable for the deferred constant, it works as expected. So I suppose that what I was really asking is why V : T; C : constant T := V; for C'Address use V'Address; does not make C a constant view of V. Surprisingly, I've done some more tests (with GNAT 3.13p) and it *does* make C a constant view of V... if done in the public part of the package. So: package Test is -- other things Machine_Order : Byte_Order := Big_Endian; Default_Byte_Order : constant Byte_Order := Machine_Order; for Default_Byte_Order'Address use Machine_Order'Address; end Test; works (at the cost of making the variable public and so allowing the back-door modification of Default_Byte_Order), but package Test is -- other things Default_Byte_Order : constant Byte_Order; private Machine_Order : Byte_Order := Big_Endian; Default_Byte_Order : constant Byte_Order := Machine_Order; for Default_Byte_Order'Address use Machine_Order'Address; end Test; does not. The only differences are that Default_Byte_Order is now deferred and Machine_Order is private. Is that an implementation issue, or the semantics intended by the ARM? I'm pretty confused right now :) Thanks, /L/e/k/t/u