comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Virtual Components in Ada and Ruby
Date: Wed, 29 Jun 2005 23:12:48 -0500
Date: 2005-06-29T23:12:48-05:00	[thread overview]
Message-ID: <9oadnZwlOoYa7V7fRVn-2A@megapath.net> (raw)
In-Reply-To: 2ifue.819$Z97.597@trndny06

"Frank J. Lhota" <NOSPAM.lhota@adarose.com> wrote in message
news:2ifue.819$Z97.597@trndny06...
....
> Looking ahead to Ada 201Z, should there be user-defined virtual record
> components? Currently, a component of a record must always be defined as
> a section of memory in a record. Would it be desirable to also be able
> to define a record component in terms of subprograms for reading and
> writing that component?

I think it would likely be too ambiguous with other possibilities to be very
useful.

Certainly, Ada 200Y has "virtual record components" for reading:

    type Something is tagged record ... end record;
    function Virtual (Obj : in Somthing) return Integer;

    Object : Something;

    if Object.Virtual = 10 then ...

But there doesn't seem to be a practical way to make them writable on the
LHS of an assignment. A procedure call isn't too bad in that case:
    Object.Set_Virtual (To => <args>);

                            Randy.







  reply	other threads:[~2005-06-30  4:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-22 15:17 Virtual Components in Ada and Ruby Frank J. Lhota
2005-06-30  4:12 ` Randy Brukardt [this message]
2005-06-30  7:53   ` Dmitry A. Kazakov
2005-06-30 15:53     ` Alexander E. Kopilovich
2005-06-30 18:55       ` Randy Brukardt
2005-07-01 10:04         ` Dmitry A. Kazakov
replies disabled

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