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.129.168.7 with SMTP id f7mr18328708ywh.164.1498039993801; Wed, 21 Jun 2017 03:13:13 -0700 (PDT) X-Received: by 10.157.46.21 with SMTP id q21mr1073754otb.11.1498039993750; Wed, 21 Jun 2017 03:13:13 -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.swapon.de!news.glorb.com!usenet.stanford.edu!x58no11155qtc.0!news-out.google.com!s132ni608itb.0!nntp.google.com!f20no2781982itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 21 Jun 2017 03:13:13 -0700 (PDT) In-Reply-To: <1ac5a44b-4423-443a-a7bb-2864d9abe78f@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5; posting-account=L2-UcQkAAAAfd_BqbeNHs3XeM0jTXloS NNTP-Posting-Host: 2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5 References: <1ac5a44b-4423-443a-a7bb-2864d9abe78f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada Annoyances From: Lucretia Injection-Date: Wed, 21 Jun 2017 10:13:13 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:47035 Date: 2017-06-21T03:13:13-07:00 List-Id: On Wednesday, 21 June 2017 02:12:51 UTC+1, pyth...@gmail.com wrote: > I've recently been trying to learn some Ada, however, I've encountered a = few annoyances. I tend to perhaps be a bit too concerned about performance,= so I try to stay away from things like tagged types when I don't actually = need them (which is most of the time). But for some reason, there are some = features that seemingly require tagged types for no reason - custom indexin= g and iterators.=20 >=20 Your thinking is pretty stupid tbh. I've come across this numerous times. "= Oh, don't use a virtual, it's slow!" It's "slower" because it needs another= load, big fucking deal, CPU's are fast enough now. In Ada, you can mostly do static calls, whereas with C++ you can't, so avoi= ding tagged types is really stupid because it's going to hinder what you ca= n do. Ada isn't as braindead as C++ so stop thinking in C++ ways when writing Ada= , it's not the right thing to do. I'm surprised you're even trying Ada given that most, if not all of it's ty= pes will have dope vectors, but you're not even checking to see what the co= mpiler is generating, so you've no clue as to whether it's using a fast pat= h or not. > My specific case is a large buffer which I want to be able to pass around= a sub-range of (i.e. I have concrete types). I could just use explicit fun= ctions to do what I want, but I'd really rather have the more convenient sy= ntax of providing custom indexing and iterators. The iterators have a specific interface that the designers wanted to enforc= e so it's easier to grasp. TBH, the current iterator stuff isn't that easy = to implement. > I just can't understand why these features require tagged types (especial= ly because I can implement custom indexing and iterators in C++ without inv= olving any kind of abstract classes or virtual functions). I assume though = that the requirement is there for some reason, so I'm curious if anyone kno= ws what that reason might be. You mean, C++'s template "system?" > I really want to like Ada, and there's some really cool things it does li= ke allowing you to very exactly specify how types should be laid out in mem= ory that are very useful for low level programming, but then I run into the= se features requiring tagged types when I very much don't need them, which = just drives me crazy. Stop thinking in C++ then and just use the language the way it's supposed t= o be used. The profile and see where your bottlenecks are, I'm betting they= 're nowhere where you think.