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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,5a88548f1bcf3510 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.66.81.195 with SMTP id c3mr943977pay.44.1353056958846; Fri, 16 Nov 2012 01:09:18 -0800 (PST) Path: 6ni88081pbd.1!nntp.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!news-hub.siol.net!news1.t-com.hr!newsfeed.CARNet.hr!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Overring function and its returned type Date: Fri, 09 Nov 2012 10:14:32 +0100 Organization: Ada @ Home Message-ID: References: <1vej4u29b8e4z$.289wazkl31wg$.dlg@40tude.net> NNTP-Posting-Host: aWaWeUaBdaj2Zzc04J1v5A.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.02 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 X-Received-Bytes: 3003 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-11-09T10:14:32+01:00 List-Id: Le Fri, 09 Nov 2012 09:24:18 +0100, Dmitry A. Kazakov = a =C3=A9crit: > On Fri, 09 Nov 2012 08:13:23 +0100, Yannick Duch=C3=AAne (Hibou57) wro= te: > >> overriding >> function F >> (E : T) >> return R'Class -- Not overriding :-( >> is abstract; > > What is this? "overriding" + "abstract" does not make sense. Overriding sometime do nothing, just remind something, recall an inherit= ed = definition explicitly. Not the same, but a bit comparable to subtyping = used for type renaming (except I hate the latter and rather like the = former). Overriding may also be used to add a postcondition or replace a class wi= de = precondition by another. I you prefer, you can instead think of `P3.F` returning `P3.R'Class` = instead of `P1.R'Class`, which would be overriding in the strict way you= = expect. > In any case it is the default. When you do nothing, you get F through > inheritance and it is abstract when the parent's F was. I know, but sometime you want something more explicit. > Ada's declarations are not idempotent, in the sense that you cannot = > repeat > them like you could in C++. So "F ... is abstract" always > overloads/conflicts. I don't get conflict when it happens I do it, it works fine. > P.S. They should really have used the syntax with the keyword = > "overriding" > trailing behind "is" rather than preceding "function/procedure." Matter of taste. Personally, it happens I think I would have preferred = =E2=80=9Cnew=E2=80=9D instead of =E2=80=9Cnot overriding=E2=80=9D, but I= don't mind too much. That's to be = added to the list of tiny things which may be nice, but not required. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity