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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,23c6847871d5deb4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-28 02:47:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsgate.cistron.nl!newsfeed.online.be!195.129.110.18.MISMATCH!bnewspeer00.bru.ops.eu.uu.net!bnewsifeed02.bru.ops.eu.uu.net!bnewspost00.bru.ops.eu.uu.net!emea.uu.net!read.news.de.uu.net!not-for-mail Message-ID: <3C04C0AA.70073D03@meppen.sema.slb.com> Date: Wed, 28 Nov 2001 11:47:06 +0100 From: Vincent Smeets Organization: CCI - SchlumbergerSema X-Mailer: Mozilla 4.77 [en] (X11; U; SunOS 5.6 sun4m) X-Accept-Language: nl, en, de MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Example of OSI package/data structure? References: <3C04A024.DEAFCE6@meppen.sema.slb.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: zerberus.cci.de X-Trace: 1006944427 read.news.de.uu.net 187 193.103.165.100 X-Complaints-To: abuse@de.uu.net Xref: archiver1.google.com comp.lang.ada:17092 Date: 2001-11-28T11:47:06+01:00 List-Id: Thank you for your reply. I will explain why I was thinking about type extension but I also will try to redesign using separate packages side-by-side. You have made me think in an other direction. Patrick Hohmeyer wrote: > > Hmm, no help, just some hints ;-) > > Why do you want Data_Link inherit from Physical ? I was thinking of Physical being a channel (line) and Data_Link extending it with the ability to transfer data over that channel (defining Send and Receive procedures). > This would give Data_Link the same interface as Physical > plus an addition. > Is that what you want ? > Shouldn't Data_Link and Physical be two complete different interfaces. > > And it would label Data_Link an extention of Physical. > But aren't in the OSI philosophy these two *independent* layers, > communication with each other through an interface? > > I simply dont see my Browser as an extended Ethernet card. > IMHO he _uses_ the Ethernet card, but he _is_ _not_ an Ethernet card. I see your browser and ethernet as a channel to transfer data. The browser sends and receives special formatted data and the ethernet transfers just data. The browser extends the ethernet with the processing of e.g. http/html. > But if you want to go with your "extention" vision, > tagged types and the first package structure are appropriated. > > I recommend the "use" vision. > There the third structure and no tagged types are recommended. > > The "extention" vision makes it very hard to have 2 Data_Link go over > the same physical device, as they are an extention of a Device, > so 2 different Data_Links _are_ 2 (different) physical devices > and I dont see how you are gonna solve this paradox. > > That's why I'd prefer the "use" approch. > > First question : > Why do you want to limite you to 2 vars in the ads? > Might it be possible that you will reuse the package on > a system with more than 2 devices? not without a software change. > Second : > When the user cant define variables, how is he supposed to > work with the type? > What you really want is not preventing the /definition/ of variables, > but the /initialization/ of variables. I was thinking of allowing something like: Data_Link.Send ( Channel => Physical.Device_1'Access, Data => "data"); > Limited private is a good choice for the type. > Then you need an initialization procedure > (a function or constant wont work, as the user cant assign anything) > something like : > procedure Init_Device (Device_To_Init : out Device; > Device_Number : in Natural); > and when Device_Number is greater than the number of devices > in this implementation, you raise an exception. I know the way of using limited types but then you have to control the number of open instances. I was thinking of having only two instances that are always open. That way I can leave out the controlling code. > This one lets the user point two variable Device > to the same physical device. > To prevent this, you may mark a Device "occupied" until > it is liberated with a second function. > Think like a file. > You may even use an only slighly modified Sequentiel_IO.ads for > the specification of the Physical package. > > > I hope you have enough information. Can you give me some help or point > > me to an example? > > > > Thanks, > > Vincent > > > > -- > Patrick Hohmeyer -- Vincent Smeets SchlumbergerSema - Competence Center Informatik GmbH Lohberg 10 - 49716 Meppen - Germany tel: +49 5931-805-461 fax: +49 5931-805-175 mail: VSmeets@slb.com web: www.cci.de