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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,901038687c38f61c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news-out2.kabelfoon.nl!83.128.0.10.MISMATCH!newsfeed.kabelfoon.nl!zen.net.uk!demorgan.zen.co.uk!194.72.9.35.MISMATCH!news-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: "Martin Dowie" Newsgroups: comp.lang.ada Subject: Re: Idiom for a class and an object in Ada Date: Tue, 19 Oct 2004 14:51:44 +0000 (UTC) Organization: BT Openworld Message-ID: References: NNTP-Posting-Host: host81-152-56-142.range81-152.btcentralplus.com X-Trace: titan.btinternet.com 1098197504 15225 81.152.56.142 (19 Oct 2004 14:51:44 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Tue, 19 Oct 2004 14:51:44 +0000 (UTC) X-RFC2646: Format=Flowed; Response X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MSMail-Priority: Normal X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Xref: g2news1.google.com comp.lang.ada:5458 Date: 2004-10-19T14:51:44+00:00 List-Id: Marin David Condic wrote: > Interesting, but I think it misses my question. In your first package: > General_Classes - if you had 5 specific objects of type Class and they > are totally static (something that exists from the moment you hit the > first instruction to the moment the power goes down and you *really* > need them to be in global memory) - where would you declare the five > objects of type "Class" as you've defined it? > > How to do it is simple: > > Object_1 : General_Classes.Class ; > Object_2 : General_Classes.Class ; > Object_3 : General_Classes.Class ; > Object_4 : General_Classes.Class ; > Object_5 : General_Classes.Class ; > > In what context would you put those objects? Inside a package body with access routines. These routines tend to be the project-specific ones. They /may/ be portable to other systems but are less likely to be portable than a class that models the behaviour of those types of registers. But in your 5 A-D examples, and assuming that the 5 A-D were on a particular device, I would consider make the package name the device name. If there was some issue with having to assign the registers into a processors particular area of memory that couldn't be done via an address clause but could only be done via a compiler/linker command, then I have separated out the data items into their own package spec - to avoid the access routines also being mapped into that area. The package names were suffixed "_GD" (for Global Data) and the coding rules were that only the package without the "_GD" could 'with' them and then only from the package body. -- Martin