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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,c52c30d32b866eae X-Google-Attributes: gidfac41,public X-Google-Thread: 1108a1,c52c30d32b866eae X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,2ea02452876a15e1 X-Google-Attributes: gid103376,public From: donh@syd.csa.com.au (Don Harrison) Subject: Re: Real OO Date: 1996/04/12 Message-ID: #1/1 X-Deja-AN: 147074146 sender: news@assip.csasyd.oz references: organization: CSC Australia reply-to: donh@syd.csa.com.au newsgroups: comp.lang.ada,comp.lang.eiffel,comp.object Date: 1996-04-12T00:00:00+00:00 List-Id: Tucker Taft writes: :One correction to my correction: : :Tucker Taft (stt@henning.camb.inmet.com) wrote: : :: Don Harrison (donh@syd.csa.com.au) wrote: [...] :: : Case1 :: : ----- :: : Ada: :: : procedure f (a: A_TYPE) f (m); static :: : f (mc); dynamic : :: : But if f not defined in same spec: :: : f (m); static :: : f (mc); static : :: f(mc) is not legal in Ada. You can't pass a dynamically tagged operand :: like "mc" to something that expects a specific type like A_TYPE. : :Sorry, I didn't make it clear that only the second f(mc) is illegal. :You can't pass a dynamically tagged operand like "mc" to something :that expects a specific type like A_TYPE, *unless* it is as part :of a dynamically bound call. Thanks for the correction. I shall refrain from being naughty by suggesting that you were confused because the mechanism is confusing :-). :: This rules helps to avoid confusion about what is and what is not :: dynamically bound, Yes, it wouldn't be nice for the same signatures to have different semantics. In Eiffel, it is clearer whether an operation dispatches or is classwide wrt an operand by virtue of whether the corresponding class contains it. : and to avoid implicit "truncation" or "slicing" :: as it is sometimes called. Unintended "slicing" is a relatively common :: source of bugs in C++. Nasty! :This is still the best rule to remember: : :: You get dynamic binding only when passing a class-wide controlling :: operand to a dispatching operation. : :: Everything else is statically bound. Succinct. :-Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ :Intermetrics, Inc. Cambridge, MA USA Don.