From: Mario Amado Alves <maa@di.fct.unl.pt>
To: "comp.lang.ada@list.deja.com" <comp.lang.ada@list.deja.com>
Subject: Re: *\\~record depth~//*
Date: 1999/11/15
Date: 1999-11-15T00:00:00+00:00 [thread overview]
Message-ID: <Pine.LNX.4.10.9911151802000.11396-100000@lexis.di.fct.unl.pt> (raw)
In-Reply-To: 3826DFBF.52AC2680@interact.net.au
The structure may in fact happen in real problems, e.g. lexical
knowledge bases, default inheritance networks.
You know you can write
type Component_List is array (Component'Range)
instead of
type Component_List is array (Component'First..Component'Last)
.
On Tue, 9 Nov 1999, G wrote:
> Message from the Deja.com forum:
> comp.lang.ada
> Your subscription is set to individual email delivery
> >
> I am still learning (autodidactically) what is probably painfully
> silly and simple to many of you.
> However - I use the Gnat compiler to learn what is possible (though
> not necessarily sensible) in Ada.
>
> Some time ago Matt Heaney explained to me here that a record
> declaration
> must only contain elements which are delimited (perhaps not in those
> exact words)
> I was playing with types tonight and I found that I could extend one
> tagged record such that I may
> include the record from which it was extended in its element list.
>
> ----------------------------------------------------------------------------------------
>
> package Problem is
>
> -- a PROBLEM is defined by its COMPONENTs and their
> ACTIONs.
>
> type Component is (Single, Dependent, Group); -- for e.g.
> type Component_List is array (Component'First..Component'Last) of
> Component;
>
> -- type Action is (Direct, Indirect); --
>
> type Simple_Problem is tagged
> record
> Unit : Component; -- a Unit
> end record;
>
> type Complex_Problem is new Simple_Problem with
> record
> Simple_Structure : Component_List; -- deeper STRUCTURE
> Simple_Recursive_Reference : Simple_Problem;
> end record;
>
> type Compound_Problem is new Complex_Problem with
> record
> Complex_Structure : Component_List; -- even deeper
> STRUCTURE
> Complex_Recursive_Reference : Complex_Problem;
> end record;
>
> end Problem;
> ------------------------------------------------------------------------------
>
> I would have thought (my grasp of symbolic logic being as admittedly
> limited
> as it is) that placing a Simple_Problem within the Complex_Problem type
> would fluff with the compiler, but it didn't. So, obviously one may do
> this sort of thing 'legally' in Ada.
>
> Would there be any programming situations where this sort of thing would
> apply
> or is it toally irrelevant ? If records are included within
> abstractions of themselves
> would that make it unneccessarily complex to assign properties to
> instances
> of the records/objects ?
>
> possibility 1) - you will tell me it is totally silly
>
> possibility 2) - you will tell me some horrendously complex tale of
> syntax and simpler ways of doing
> precisely the same things.
>
> I am just wondering out loud and as I have this wonderful facility of
> communication with the
> boffins I thought I would ask.
>
>
> -Graeme
> -Australia
>
>
>
>
> _____________________________________________________________
> Deja.com: Before you buy.
> http://www.deja.com/
> * To modify or remove your subscription, go to
> http://www.deja.com/edit_sub.xp?group=comp.lang.ada
> * Read this thread at
> http://www.deja.com/thread/%3C3826DFBF.52AC2680%40interact.net.au%3E
>
| | |,| | | | |RuaFrancTaborda24RcD 2815-249CharnecaCaparica 351+212976751
| |M|A|R|I|O| | mob 219354005
| |A|M|A|D|O| |DepartmentoInformaticFCT/UNL 2825-114Caparica 351+212958536
| |A|L|V|E|S| | fax 212948541
| | | | | | | | maa@di.fct.unl.pt FCT 212948300
Sent via Deja.com http://www.deja.com/
Before you buy.
next prev parent reply other threads:[~1999-11-15 0:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-09 0:00 *\\~record depth~//* G
1999-11-08 0:00 ` Nick Roberts
1999-11-09 0:00 ` Robert Dewar
1999-11-09 0:00 ` David C. Hoos, Sr.
1999-11-09 0:00 ` Robert Dewar
1999-11-09 0:00 ` oops - same with neater formatting G
1999-11-15 0:00 ` Mario Amado Alves [this message]
1999-11-15 0:00 ` *\\~record depth~//* Matthew Heaney
1999-11-16 0:00 ` G
1999-11-16 0:00 ` Robert Dewar
1999-11-16 0:00 ` Robert Dewar
1999-11-16 0:00 ` Robert A Duff
1999-11-16 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox