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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.241.1 with SMTP id c1mr2199250iti.15.1520612677824; Fri, 09 Mar 2018 08:24:37 -0800 (PST) X-Received: by 10.157.11.165 with SMTP id 34mr1549309oth.7.1520612677743; Fri, 09 Mar 2018 08:24:37 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!e10-v6no339564itf.0!news-out.google.com!a2-v6ni1009ite.0!nntp.google.com!r195no340236itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 9 Mar 2018 08:24:37 -0800 (PST) In-Reply-To: <1aac45bf-2baf-4ca5-9cb5-07e1748ff6b4@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=47.185.233.194; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.233.194 References: <1aac45bf-2baf-4ca5-9cb5-07e1748ff6b4@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <06ffd998-f5b4-4ffd-a23e-cf922df2681b@googlegroups.com> Subject: Trouble translating a C++ data-structure. From: "Dan'l Miller" Injection-Date: Fri, 09 Mar 2018 16:24:37 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 4091 X-Received-Body-CRC: 1878802689 Xref: reader02.eternal-september.org comp.lang.ada:50909 Date: 2018-03-09T08:24:37-08:00 List-Id: shark8 wrote: > I found a data-structure implemented in C++, a van Emde Boas Tree, > and tried to write the equivalent in Ada, both using the dump-ada-spec > flag w/ manual fixups AND a from-scratch transliteration, but was unable > to really do so (my C++ is really rusty).=20 Which precise areas are the biggest gaps of understanding? As pointed out = above, this is garden-variety 1970s-era structured-programming non-OO C-lan= guage memory allocation from the heap. There exist a multitude of before &= after transliterations from C data structures to Ada from which to borrow = various flavors of ideas about Ada-83-era or post-Ada-95-era properness in = Ada. Depending on how rusty your C/C++ knowledge is, people who reply wouldn't w= ant to talk condescendingly to you about this matter here which you already= know when what you need is that matter over yonder. https://stackoverflow.com/questions/20879589/what-prevents-van-emde-boas-tr= ees-from-being-more-popular-in-real-world-applicat One observation though inherent in this data structure independent of skill= s, (as mentioned in the 2nd StackOverflow answer) it seems that the vEBTs i= nherently have a maximum universe size built into them: referred to as M i= n their Wikipedia article in a prior reply. Is, for example, some form of = maximum storage-pool size in Ada a key design feature that you are seeking?= I mention this because the C-language heap implementation tries to bury/o= bfuscate M as much as possible by being heap-based. The more that your Ada= design emphasizes drastically different design goals (e.g., overtly showca= sing what that other design obfuscates), the more that the Ada way will nat= urally differ from the C-language representation at that GitHub project. Btw, Shark8/Edward, I took a look around your Byron Ada front-end work on G= itHub. Excellent work. Please push ahead as much as time allows. Along t= he =E2=80=9C"functional" programming in Ada=E2=80=9D posting's threads, I p= osted a vision of what one aspect of a drastically-not-GNAT modern Ada comp= iler could look like regarding multi-stage programming and/or source-code g= eneration via generous amounts of compile-time reflection & some sort of Ad= a-get-it-right/elegant/not-Boost-C++-MTP analysis/reactions thereof via som= e sort of compile-time imperative or functional language. Another drastica= lly-not-GNAT open-source Ada compiler needs some sort of special-sauce thin= g that it does better as its killer app to attract people in. (For Clang & LLVM displacing GCC at Apple and at FreeBSD, its special sauce= seems to be written in modern-OO C++ instead of old clunky C. GNAT's fron= t end already is written in something far more lucid & OOish than old clunk= y C, so what is Byron's special sauce instead? Perhaps a new top-level pos= ting on comp.lang.ada instead of here.)