comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Trouble translating a C++ data-structure.
Date: Fri, 9 Mar 2018 08:24:37 -0800 (PST)
Date: 2018-03-09T08:24:37-08:00	[thread overview]
Message-ID: <06ffd998-f5b4-4ffd-a23e-cf922df2681b@googlegroups.com> (raw)
In-Reply-To: <1aac45bf-2baf-4ca5-9cb5-07e1748ff6b4@googlegroups.com>

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). 

Which precise areas are the biggest gaps of understanding?  As pointed out above, this is garden-variety 1970s-era structured-programming non-OO C-language 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 want 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-trees-from-being-more-popular-in-real-world-applicat

One observation though inherent in this data structure independent of skills, (as mentioned in the 2nd StackOverflow answer) it seems that the vEBTs inherently have a maximum universe size built into them:  referred to as M in 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/obfuscate M as much as possible by being heap-based.  The more that your Ada design emphasizes drastically different design goals (e.g., overtly showcasing what that other design obfuscates), the more that the Ada way will naturally 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 GitHub.  Excellent work.  Please push ahead as much as time allows.  Along the “"functional" programming in Ada” posting's threads, I posted a vision of what one aspect of a drastically-not-GNAT modern Ada compiler could look like regarding multi-stage programming and/or source-code generation via generous amounts of compile-time reflection & some sort of Ada-get-it-right/elegant/not-Boost-C++-MTP analysis/reactions thereof via some sort of compile-time imperative or functional language.  Another drastically-not-GNAT open-source Ada compiler needs some sort of special-sauce thing 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 front end already is written in something far more lucid & OOish than old clunky C, so what is Byron's special sauce instead?  Perhaps a new top-level posting on comp.lang.ada instead of here.)


  parent reply	other threads:[~2018-03-09 16:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-08  0:37 Trouble translating a C++ data-structure Shark8
2018-03-08  0:49 ` Paul Rubin
2018-03-08  2:33 ` gautier_niouzes
2018-03-09 16:24 ` Dan'l Miller [this message]
2018-03-09 22:44   ` Shark8
2018-03-10  3:02     ` Bojan Bozovic
2018-03-10 12:45       ` Bojan Bozovic
2018-03-10 18:10         ` Shark8
2018-03-12 16:07     ` Dan'l Miller
2018-03-12 23:46     ` Randy Brukardt
2018-03-12 19:49 ` Mehdi Saada
2018-03-12 22:26   ` Shark8
2018-03-13  1:22   ` Paul Rubin
2018-03-13  2:11   ` Dan'l Miller
2018-03-13 19:51     ` Paul Rubin
2018-03-13 23:35       ` Dan'l Miller
2018-03-14  4:28         ` Dan'l Miller
2018-03-14  3:14       ` Shark8
2018-03-14  4:44         ` Bojan Bozovic
2018-03-14  5:10           ` Paul Rubin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox