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 X-Google-Thread: 103376,ab66185f2bca0483 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-14 06:27:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Extension of non-limited type needs limited component Date: Thu, 14 Nov 2002 15:27:11 +0100 Message-ID: <3vb7tug4h99mmalcn0l5ul18cu0ui6i458@4ax.com> References: <2dbd76f3.0211130203.7d2d14fd@posting.google.com> <2dbd76f3.0211140126.5d233e41@posting.google.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: fu-berlin.de 1037284031 14762063 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:30872 Date: 2002-11-14T15:27:11+01:00 List-Id: On Thu, 14 Nov 2002 13:33:07 +0100, "Jean-Pierre Rosen" wrote: >"Mike" a �crit dans le message news: >2dbd76f3.0211140126.5d233e41@posting.google.com... >> How can assignment by upcasting the extended type possibly affect the >> limited component? >> >Consider: > > X : T'class := Some_Dynamic_Function (1); > Y : T'class := Some_Dynamic_Function (2); >begin > X := Y; > >At compile time, we know nothing about the specific type of the values in X >and Y, but assuming that T is not limited, the assignment is allowed. If X >and Y happen to have different tags at run time, the assignment will raise >Constraint_Error, but that's all. > >If you were allowed to extend T with limited components, you would >effectively copy the limited components! An LSP violation to put it short. Which also raises an interesting question, whether T'Class should always inherit "non-limitness" of T. Or more generally shouldn't one have an ability to disallow primitive operations (like ":=" in case of non-limited->limited mutation)? Let we allow disallowing, then either 1. ":=" should dispatch in X:=Y to a disallowed operation, thus raise an exception and so refuse to copy the limited components. 2. ":=" is class-wide in the right parameter, then it will dispatch somewhere within its body and again an exception will happen if an attempt to copy a limited component will be made.. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de