comp.lang.ada
 help / color / mirror / Atom feed
* Access-to-Constant parameters
@ 2000-05-08  0:00 m_cubed
  0 siblings, 0 replies; 2+ messages in thread
From: m_cubed @ 2000-05-08  0:00 UTC (permalink / 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;


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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Access-to-Constant parameters
@ 2000-05-08  0:00 m_cubed
  0 siblings, 0 replies; 2+ messages in thread
From: m_cubed @ 2000-05-08  0:00 UTC (permalink / 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.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-05-08  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-08  0:00 Access-to-Constant parameters m_cubed
  -- strict thread matches above, loose matches on Subject: below --
2000-05-08  0:00 m_cubed

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