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,9eaef25f8adbf762 X-Google-Attributes: gid103376,public From: stt@henning.camb.inmet.com (Tucker Taft) Subject: Re: access to subprogram disciminants Date: 1996/04/24 Message-ID: #1/1 X-Deja-AN: 151210655 sender: news@inmet.camb.inmet.com (USENET news) x-nntp-posting-host: henning.camb.inmet.com references: <4livr5$rq3@news1.delphi.com> organization: Intermetrics, Inc. newsgroups: comp.lang.ada Date: 1996-04-24T00:00:00+00:00 List-Id: tmoran@bix.com wrote: : I want to declare an object with parameters, in particular, a : procedure parameter. In Ada 83 I would have put the object in a : generic package and used the procedure as a parameter of the package. : In Ada 95 it appears I can make the object a record with a discriminant : of 'access to subprogram' type. But when I try this, it always seems : to run into accessibility problems. You example, after filling in the "..." with something reasonable, compiles fine for me. What is the "accessibility" problem you are having? Are you trying to use a nested procecedure? : package definer is : type a_s is access procedure(x:in out integer); : type objects(s:a_s) is record ... : end definer; : with definer; : package user is : procedure p(x:in out integer); : object:objects(p'access); ^^ "definer." : .. : 1) How is this supposed to be done? I'm not sure what you are trying to accomplish, but the above is legal (modulo a few typos, etc.) : 2) Other than generics or discriminants of records (or tasks), : what other ways are there of creating parameterized objects in Ada? Again, I am not exactly sure what you mean by "parameterized" objects. It might be helpful to understand the ultimate problem you are trying to solve. The specific solution you have sketched out doesn't explain what is the underlying task to be solved. -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Cambridge, MA USA