comp.lang.ada
 help / color / mirror / Atom feed
From: m_cubed@my-deja.com
Subject: Access-to-Constant parameters
Date: 2000/05/08
Date: 2000-05-08T00:00:00+00:00	[thread overview]
Message-ID: <8f5t2m$g0i$1@nnrp1.deja.com> (raw)

Ada provides access-to-variable parameters in
operation signatures which allow dispatching.
For example:

type State Type is tagged private;

Set_Exercise_Mode (
  State_Ptr: access State_Type;
  Exercise_Mode: in Exercise_Mode_Type);

What it doesn't seem to provide is
access-to-constant parameters for dispatching
operations. For example, it would be useful to
do the following to ensure that the query doesn't
update the object being queried (hypothetical
syntax):

function Exercise_Mode (
  State_Ptr: access constant State_Type)
  return Exercise_Mode_Type;

Is there any way of doing this, or am I forced
to sacrifice dispatching by using a specific
access-to-constant type as the formal parameter?
For example:

type State_Type is tagged private;

type RO_Access_State_Type is
  access constant State_Type;

function Exercise_Mode (
  State_Ptr: RO_Access_State_Type)
  return Exercise_Mode_Type;da provides
access-to-variable parameters in
operation signatures which allow dispatching.
For example:

type State Type is tagged private;

Set_Exercise_Mode (
  State_Ptr: access State_Type;
  Exercise_Mode: in Exercise_Mode_Type);

What it doesn't seem to provide is
access-to-constant parameters for dispatching
operations. For example, it would be useful to
do the following to ensure that the query doesn't
update the object being queried (hypothetical


Sent via Deja.com http://www.deja.com/
Before you buy.




             reply	other threads:[~2000-05-08  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-08  0:00 m_cubed [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-05-08  0:00 Access-to-Constant parameters m_cubed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox