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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,dbbbb21ed7f581b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!feeder.erje.net!news.osn.de!diablo1.news.osn.de!noris.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Operation can be dispatching in only one type Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <691d6892-bc5e-4d81-8025-c36556bf2593@13g2000prl.googlegroups.com> Date: Thu, 19 Nov 2009 09:32:34 +0100 Message-ID: <14i0ogkos0ggq.1j3iq8bn1g39a.dlg@40tude.net> NNTP-Posting-Date: 19 Nov 2009 09:32:34 CET NNTP-Posting-Host: a0dd1e7a.newsspool4.arcor-online.net X-Trace: DXC=QN?[QnW5l]^cHPTNZh_e7Q4IUK_a On Thu, 19 Nov 2009 02:23:07 +0000 (UTC), tmoran@acm.org wrote: >> package Documents is >> >> type Document is abstract tagged private; >> type Text_Region is abstract tagged private; >> type Marker is abstract tagged private; >> ... >> procedure Move_Text (Doc : in out Document; >> From : in Text_Region; >> To : in Marker) >> is abstract; > > There's really no way at compile time to require a particular > relationship between two (or more) arbitrary parameters to a procedure. > If that's necessary, you usually combine them into a single object that's > a single parameter. Yes, this is why I consider these cases single dispatch on a tuple of types. It is like type Editing is interface (Document, Region, Marker); And the operations are in fact defined on Editing, which has only one tag. > Thus if a Document could have up to 10 defined > Text_Regions and 20 Markers one could say > > type Document is abstract tagged private; > -- Presumably includes an array or list of appropriate Text_Region > -- descriptors and of Marker descriptors. > > type Text_Region_Ids is range 1 .. 10; > type Marker_Ids is range 1 .. 20; > > procedure Move_Text (Doc : in out Document; > From : in Text_Region_Ids; > To : in Marker_Ids) > is abstract; It is not ADT. ID does not have finalization and cannot refer to a specific Document. You will not be able to transparently manage Regions and Markers. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de