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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Functions vs constants Date: Fri, 25 Jul 2014 22:02:26 +0200 Organization: cbb software GmbH Message-ID: <8xoyoz9pw6he$.djx7dfd6myjj.dlg@40tude.net> References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: qHNcUCBwwd01dPSBp/L1cg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:187876 Date: 2014-07-25T22:02:26+02:00 List-Id: On Fri, 25 Jul 2014 14:31:06 -0500, Randy Brukardt wrote: > "Georg Bauhaus" wrote in message > news:lqsueh$q0v$1@dont-email.me... >> On 25/07/14 06:56, Randy Brukardt wrote: > ... >>> In what sense is Put for a >>> String overriding Put for a Float? Dmitry covered this ground pretty well >>> in his response. >> >> His answer includes, actually, that for Put you need non-Ada only >> if the file argument should be included in dispatching. Any Float >> or String arguments could be passed to an overridden version of Put >> determined statically. > > Huh? "overriding" only works for related types. In what universe are Float > and String related? They have almost no common operations. "overloading" > (which you don't want to use) works for any types, including unrelated ones. One thing missing in Ada is ad-hoc supertypes. That is when you could create a common parent for existing types. E.g. Ada.Text_IO would create an interface Printable and then pronounce it a supertype of Integer, Float, String etc. After that Put will become a primitive operation of Printable and thus overridden rather than overloaded. This is also the way of having containers of Float and String without having a premeditated common parent type. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de