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,961b968d014d8843 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-27 11:58:54 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!uwm.edu!news.alpha.net!news.mathworks.com!news2.near.net!news3.near.net!noc.near.net!inmet!henning!stt From: stt@henning.camb.inmet.com (Tucker Taft) Subject: Re: Ada Objects Help! Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <3f9g1u$j4m@nps.navy.mil> <1995Jan24.230910.2241@nbivax.nbi.dk> Date: Fri, 27 Jan 1995 19:58:54 GMT Date: 1995-01-27T19:58:54+00:00 List-Id: In article , Robert A Duff wrote: > ... >By the way, dispatching on result is an interesting twist that most OOP >languages don't have: > > function Union(X, Y: Set) return Set; > function Empty_Set return Set; > > X: Set'Class := ...; > Y: Set'Class := Union(X, Empty_Set); >The appropriate version of function Empty_Set to call is determined (at >run time) based on the tag of Y, since Empty_Set itself doesn't have any ^^ "X" >controlling parameters. Although I presume Bob meant "X" in the above paragraph, you actually *can* use the left-hand side of an assignment statement (rather than an initialization) to control the dispatching. For example, presuming Y was declared as above, we can later assign into Y again as follows: Y := Union(Empty_Set, Empty_Set); In this example, Y is the only thing with a pre-determined tag, and it controls all dispatching. >- Bob -Tucker Taft stt@inmet.com Intermetrics, Inc.