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,50137bb64a119cfc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-10 10:57:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc04.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: "access constant" discriminant References: <_TO1a.14664$9y2.6601@nwrddc01.gnilink.net> X-Newsreader: Tom's custom newsreader Message-ID: <3CS1a.55972$2H6.1357@sccrnsc04> NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc04 1044903423 12.234.13.56 (Mon, 10 Feb 2003 18:57:03 GMT) NNTP-Posting-Date: Mon, 10 Feb 2003 18:57:03 GMT Organization: AT&T Broadband Date: Mon, 10 Feb 2003 18:57:03 GMT Xref: archiver1.google.com comp.lang.ada:33967 Date: 2003-02-10T18:57:03+00:00 List-Id: >What is it that you want to do? In the case at hand, I'm using the idiom of a limited controlled type whose initialization/finalization grabs/releases a resource lock, and the access discriminant tells which resource. type Lock_Type(Resource : access Resource_Type) is new Ada.Finalization.Limited_Controlled with ... and later Locker : Lock_Type(Resource'unchecked_access); ... But this won't work when Resource is an "in" parameter, eg a function parameter. I suppose Ada is telling me that grabbing a lock is effectively modifying the resource, and thus something that shouldn't be done when the resource is an "in" parameter, but the question remains, why can't one say type Lock_Type(Resource : access constant Resource_Type) ... Did the designers foresee and forestall my use with a function?