From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8e0e21432ac3eca6 X-Google-Attributes: gid103376,public From: Mario Amado Alves Subject: Re: *\\~record depth~//* Date: 1999/11/15 Message-ID: #1/1 X-Deja-AN: 548914898 Content-Transfer-Encoding: 7bit References: <3826DFBF.52AC2680@interact.net.au> To: "comp.lang.ada@list.deja.com" X-DejaID: _/hTaF8af+B8jhj9UKgbIZA= X-Authentication-Warning: lexis.di.fct.unl.pt: maa owned process doing -bs Content-Type: text/plain Organization: Deja.com - Before you buy Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-11-15T00:00:00+00:00 List-Id: 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.