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,19d0849c68914783 X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Design problem using Multiple Dispatch or Redispatch (long) Date: 2000/03/16 Message-ID: #1/1 X-Deja-AN: 598152239 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 References: <38CDAA56.36B9E1C1@yahoo.com> <38CEF549.90AD0C67@yahoo.com> X-Trace: news.demon.co.uk 953188382 nnrp-12:24352 NO-IDENT pogner.demon.co.uk:158.152.70.98 Organization: At Home Newsgroups: comp.lang.ada X-Complaints-To: abuse@demon.net Date: 2000-03-16T00:00:00+00:00 List-Id: Thom Brooke writes: > Consider a command that has three fields: ID, Number, and Version. > And two kinds of Processors. I would do this, right? > > with Commands; > with Processors; > package Real_Processor1 is > > type Processor1 is new Processors.Processor with private; > > type Command1 (For_The : access Processor1) > is new Commands.Command with private; > procedure Handle (The_Command : Command1); > -- and I added this as a new primitive abstract operation: > procedure Construct (The_Command : in out Command1; > From : in Byte_Stream); > > -- same thing for Real_Processor2 > > So the problem is, how can I write the "Construct" procedure one > time (the resulting Commands will look identical, and they come from > identical byte streams. The only difference is one is of type > Real_Processor1.Command1, and the other is of the completely > different, but structurally identical type > Real_Processor2.Command1)? Are lots of commands repeated for different processors? in the application form which this came, they were all wildly different. I suppose you could have an intermediate Shared_Command with a Construct? (could it still be abstract?) type Shared_Command is abstract new Command with private; procedure Construct (The_Command : in out Shared_Command; From : in Byte_Stream); and then in the Real_Processor1 package type Command1 is new Shared_Command with private; procedure Handle (The_Command : Command1); -- Simon Wright Work Email: simon.j.wright@gecm.com Alenia Marconi Systems Voice: +44(0)23-92-701778 Integrated Systems Division FAX: +44(0)23-92-701800