From: Andy <andy@nospam.tj>
Subject: Re: access-to-constant dispatching params
Date: 2000/05/08
Date: 2000-05-08T14:02:37+00:00 [thread overview]
Message-ID: <3916BA40.3839@nospam.tj> (raw)
In-Reply-To: 8f5t2r$g0k$1@nnrp1.deja.com
m_cubed@my-deja.com wrote:
>
> Ada provides access-to-variable dispatching
> parameters.
>
> For example:
>
> procedure 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 dispatching parameters.
> It would be useful to be able to ensure that
> a query on an object is prevented from
> accidentally updating the object. For example,
> (in hypothetical syntax):
>
> function Exercise_Mode (
> State_Ptr: access constant State_Type)
> return Exercise_Mode_Type;
>
How about using an in parameter?
function Exercise_Mode (
State : in State_Type)
return Exercise_Mode_Type;
If the code that uses this type are maintaining some sort of structure,
list or array of State_Type pointers, one can always dereference:
Mode := Exercide_Mode (State => State_Ptr.all);
___________________________________________
Andy
___________________________________________
next prev parent reply other threads:[~2000-05-08 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-08 0:00 access-to-constant dispatching params m_cubed
2000-05-08 0:00 ` Andy [this message]
2000-05-09 0:00 ` don_harrison
2000-05-08 0:00 ` Tucker Taft
2000-05-09 0:00 ` don_harrison
2000-05-09 0:00 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox