Re:A Better Way to Implement Bit Fields
by MisterTea on Thursday November 15, 2018 @03:41PM
(#18463074)
Ah Ada. Reminded me of my high school years playing with Turbo pascal before moving to c/c++. First concurrent language I ever worked with. Thought that feature was brilliant, so much nicer than pthreads. I took a small threaded c project of mine and replaced the pthreading with Ada and linked the c logic to it using gnat/gcc. Then along came Go, et al, and my interest in Ada unfortunately faded.
Now you got me thinking about Ada again.
Re:A Better Way to Implement Bit Fields
by touisteur on Thursday November 15, 2018 @04:56PM
(#18463816)
To jog your memory and for the curious reading this, a chapter of the new 'learn Ada' interactive tutorial by AdaCore introduces tasking: https://learn.adacore.com/courses/intro-to-ada/chapters/task...
The whole interactive book deserves a look. You can then jump to the Spark book :-D https://learn.adacore.com/courses/intro-to-spark/index.html that sadly doesn't seem to talk about tasking but Spark supports part of it.
I'm actually looking forward the next few years, as AdaCore seems to be working on memory ownership-based guarantees a la rust (at least partially) and this might make Ada (or Spark in a first pass) a good candidate for truly fearless concurrency :-D.
You can also set the endianness (bit and byte order) : https://www.adacore.com/gems/gem-140-bridging-the-endianness... (I think it was added in a recent language revision).
Add to that the 'Component_Size attribute and the ability to specialize representation information easily : https://www.adacore.com/gems/gem-27 and https://www.adacore.com/gems/gem-28) and also the ability to recursively bound-check record structures (see https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/i... and https://dwheeler.com/lovelace/s17s4.htm for some background on 'valid and specific Ada safety extensions) you get a pretty elegant and powerful way to interact with low-level constructs.