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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.98.147.67 with SMTP id b64mr15700263pfe.38.1498085156323; Wed, 21 Jun 2017 15:45:56 -0700 (PDT) X-Received: by 10.157.46.132 with SMTP id w4mr757850ota.18.1498085156279; Wed, 21 Jun 2017 15:45:56 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f20no521685itb.0!news-out.google.com!k7ni1186itk.0!nntp.google.com!185no516884itv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 21 Jun 2017 15:45:56 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=68.114.51.240; posting-account=HN9B-woAAACqJDcuOavWYdk7s1Vm8fv7 NNTP-Posting-Host: 68.114.51.240 References: <1ac5a44b-4423-443a-a7bb-2864d9abe78f@googlegroups.com> <1498048151.20885.28.camel@obry.net> <96174ea5-852d-44e9-8535-7c1eb24d5326@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <98b98b8b-2f56-4d14-9989-3df51b08d97e@googlegroups.com> Subject: Re: Ada Annoyances From: pythoner6@gmail.com Injection-Date: Wed, 21 Jun 2017 22:45:56 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:47052 Date: 2017-06-21T15:45:56-07:00 List-Id: On Wednesday, June 21, 2017 at 12:12:53 PM UTC-4, Dmitry A. Kazakov wrote: > In Ada there is no penalty of calling a "method" vs. a "free" function.= =20 > None, whatsoever. This per language type system design and different=20 > from C++. I would say the same is true of C++ -- a method in C++ just has an implicit= parameter that would be explicit in Ada (the only potential difference I c= an think of is that the implicit parameter is always by reference in C++ wh= ere Ada may choose to pass it by value, unless as you note you are dealing = with a tagged type). > I don't consider here the overhead of using any helper types/objects=20 > and/or class-wide objects. That has nothing to do with the type under=20 > consideration being tagged or not. >=20 > The penalty of a tagged type is only this: >=20 > 1. Space to keep the type tag > 2. By-reference passing only, even if the object is small. >=20 > --=20 > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de Thanks for the clarifications - as mentioned in my previous post, I think t= he main misconception I had was about when dynamic dispatch happens: I rath= er naively assumed that dynamic dispatch happened whenever tagged types wer= e involved. After reading this it sounds like using tagged types in Ada is = quite similar to dealing with classes in C++ (i.e. in C++, methods have the= implicit this parameter which is also only ever passed by reference). Now = that I better understand how tagged types work, I think I don't really mind= the restriction.