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.66.235.36 with SMTP id uj4mr1786893pac.9.1378339989708; Wed, 04 Sep 2013 17:13:09 -0700 (PDT) X-Received: by 10.49.99.65 with SMTP id eo1mr266364qeb.3.1378339989329; Wed, 04 Sep 2013 17:13:09 -0700 (PDT) Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.astraweb.com!border3.a.newsrouter.astraweb.com!multikabel.net!newsfeed10.multikabel.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!209.85.160.87.MISMATCH!y3no1992408pbx.0!news-out.google.com!z6ni32996pbu.0!nntp.google.com!y3no1992407pbx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 4 Sep 2013 17:13:09 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=188.23.136.115; posting-account=EGQ3wAoAAABMlvcviStPLgY0shtgbvUX NNTP-Posting-Host: 188.23.136.115 References: <9ec51e40-081f-4ec7-b17f-7c73dbdcd10a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7b8fb992-9fdb-48d2-8613-92e234e46f00@googlegroups.com> Subject: Re: How (or Where?) to get started on Ada? (Properly) From: e.s.harney@gmail.com Injection-Date: Thu, 05 Sep 2013 00:13:09 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 14873 Xref: number.nntp.dca.giganews.com comp.lang.ada:183298 Date: 2013-09-04T17:13:09-07:00 List-Id: > read (for C++) Stan Lippman's _Inside the C++ object model_ That looks fascinating. I have been looking up details on these topics, but= it seems I've been looking in the wrong places so far. I never expected th= ere to be books on the inner workings of production-grade compilers/runtime= s. If you have any more suggestions in this direction I would be very excited = about them. > If this is what you mean by "knowing virtually nothing about what the syn= tax actually does" and "the intricate semantics of C++ were a deal-breaker"= , then you have completely grasped the current (dystopian) state of C++ Metaprogramming/Generics through templates in C++ is bad, but this is not w= hat I meant. To be fair, Stroustrup himself has condemned some of the templ= ate abuse in Boost as "too clever" and they're trying to improve the situat= ion on this front by adding little details like static if and so on.. Also = this is a hard problem to solve - mixing subtyping with parametric polymorp= hism (sort of the equivalent of "duck typing" in more dynamic languages). I= 'm not aware of any (strongly typed) language that pulls this off without m= essing up one way or the other (I've yet to look at Ada Generics though, an= d occaml supposedly has done it pretty sanely too, though the language neve= r really appealed to me.) Instead I'm more with the C++ FQA in that there is no one single thing that= , when looked at in isolation, makes C++ bad. It is rather the way in which= things interact that results in too much total complexity.=20 Things like type compatibility with const-vs-non-const and const-type-vs-co= nst-pointer, rvalues-vs-lvalues-vs-copies, "logical" const vs mutable vs c+= +11 "bitwise" const, function return being essentially implementation defin= ed (due to compilers being allowed to exhibit different observable side eff= ects when applying return value optimizations), unclear thread semantics du= e to "storage locations" being an "implementation defined" detail, and so o= n.=20 And to top it all of, they added lambdas in C++11.. If you want to see some= truly mindbogging piece of code (20 LOC only; nested self-capturing/callin= g reference-counted lambdas to simulate the async/await functionality in C#= ), look at slide 50 in this presentation by Herb Sutter (http://video.ch9.m= s/sessions/build/2013/2-306.pptx or http://postimg.org/image/5xtnrnr63/ for= just the piece of code if the PowerPoint file isn't working for you). No one of these things would too hard to grasp when dealing with it alone, = but add them all together and you're in for some real headache. I'm sure th= ere's some reason everything ended up the way it is, but there's (imho) lit= tle reason to have to deal with all of it if there's no one actually forcin= g you to. On Wednesday, September 4, 2013 6:09:51 PM UTC+2, Dan'l Miller wrote: > On Wednesday, September 4, 2013 4:14:55 AM UTC-5, e.s.h...@gmail.com wrot= e: >=20 > > As a programmer that has spent most of his time in managed environments= so far (Java mostly, with some PHP and Python here and there), I have been= trying to get more into "native code" recently, in order to be able to con= trol things like memory layout and get deterministic resource usage (and th= us deterministic run time performance).=20 >=20 > >=20 >=20 > > Initially I started looking at C/C++, but soon realized that the intric= ate semantics of C++ were a deal-breaker (and not necessary for what I was = looking for anyways) and that C lacked too many libraries (hash tables, fil= e systems, threading, etc.) to be useful for one-man-projects these days (y= es there's things like APR or GLib but those are quite a bit of a hassle).= =20 >=20 > > [...snip...] >=20 > > TL;DR: >=20 > > What I am struggling the most when learning new languages is knowing vi= rtually nothing about what the syntax actually does. I have tried some onli= ne tutorials that manage to walk me through the compilation process and the= n slowly introduce new languages pieces through example programs, but (for = me at least) that has been a rather frustrating experience, considering tha= t I'm essentially just copy-pasting code (and having to ignore irrelevant b= its in the code that are not relevant yet, but still necessary for it to ru= n).. >=20 > >=20 >=20 > > What I'm looking for is a text that starts from the other way, i.e. exp= lains the language blocks, the data/object model, etc. first, and only afte= r that goes on to provide full examples of working code. I guess this is so= mething I'll only be able to find in a book. >=20 > >=20 >=20 > > I did look on Amazon about available books, but all of them seem fairly= dated. "Programming in Ada 2005" by John Barnes did look interesting judgi= ng by the reviews, yet I'm not sure of how helpful it will be in covering a= ll details that are relevant to writing useful software these days (things = like utf8, interfacing with C, etc.). >=20 > >=20 >=20 > > Do you have any recommendations for me? >=20 >=20 >=20 > Well, there are generally 4 major eras of Ada: Ada83, Ada95, Ada2005, Ad= a2012. Ada83 (code-named Green during the competition) was a design-by-com= mittee during the 1970s and early 1980s, but with a strong counter-cultural= attitude by Jean Ichbiah, Green team's lead designer. Some of that counte= r-cultural attitude has been beneficial (e.g., the vigorous pursuit of corr= ect object lifetimes), whereas other portions of that counter-cultural atti= tude was Ada83's downfall (e.g., accomplishing goals via Draconian restrict= ions). I came first to Ada83, then, after having been repulsed by its exce= ssive restrictions and lack of runtime polymorphism, spent the next 20 year= s in C++, which was designed with the style of Ada83 done "correctly" from = the C-minded slapstick perspective of the Marx Brothers' "Doctor it hurts w= hen I do this!" "Well, then don't do that!" Like Austin Obyrne's posting = above, I came back to modern Ada decades later, when I became repulsed to c= ore of my being at C++'s (especially Boost Libraries') excessive use of (po= orly-)emulated functional programming in the metatemplate programming style= of using the Turing-complete (at compile-time) capabilities of C++ templat= es. The compile-time error messages emitted by metatemplate programming is= cryptic & obtuse at best, and little better that "unknown error at unknown= location" at worst. If this is what you mean by "knowing virtually nothin= g about what the syntax actually does" and "the intricate semantics of C++ = were a deal-breaker", then you have completely grasped the current (dystopi= an) state of C++, and I wholeheartedly agree with you at some level much fu= rther along the learning curve. >=20 >=20 >=20 > But conversely if you mean that you do not understand the canonical imple= mentation of virtual functions as a per-instance pointer to a type's virtua= l-function table singleton(-per-type) that is an array of runtime-polymorph= ic function-pointers to call, as the fundamental rubber-meets-the-road mech= anism of OOP, then you need to read (for C++) Stan Lippman's _Inside the C+= + object model_, which predates metatemplate programming and hence is not c= ontaminated by that MTP filth. The underlying underpinnings of C++ can be = thought of as the child's play-toy version of the industrial-strength under= lying underpinnings of Ada95-&-onward, with C++'s per-instance pointer to v= irtual-function table roughly analogous to Ada95-&-onward's tag in a tagged= record, for example. Independent of language, you need to learn what the = "native" machine-language languages do. I suspect that this book will real= ly stoke the fire in your mind, solving many mysteries in pre-MTP C++, Ada9= 5-&-onward, and even some C. From this stronger basis in what "native"/"un= managed" machine-language programming-languages do, your learning of Ada wi= ll likely be accelerated as you will be able to visualize in your mind what= is happening at the machine-language level for each feature in Ada (even i= f no such textual explanation appears in the later Ada books that you are r= eading). http://www.amazon.com/Inside-Object-Model-Stanley-Lippman/dp/02018= 34545/ref=3Dsr_1_1?s=3Dbooks&ie=3DUTF8&qid=3D1378307415&sr=3D1-1&keywords= =3DC%2B%2B+object+model >=20 >=20 >=20 > For C & C++ programmers coming to Ada95-&-onward, I recommend Norman Cohe= n's _Ada as a second language_, which for you, would be after you read Stan= Lippman's underlying-underpinnings-of-C++ book above. As with Stan Lippma= n's book, Norman Cohen's book predates metatemplate programming, so it is n= ot polluted by that filth. http://www.amazon.com/Ada-Second-Language-Norma= n-Cohen/dp/0070116075/ref=3Dsr_1_5?s=3Dbooks&ie=3DUTF8&qid=3D1378305539&sr= =3D1-5&keywords=3Dada >=20 >=20 >=20 > The most lucid revelation of Ada2005 semantics (including Ada95) is (Brit= ish) John Barnes's _Programming in Ada2005 with CD_. I wish John Barnes wo= uld add another several hundred pages (perhaps as a Volume Two) and merge i= n the equivalent of Stan Lippman's underlying-underpinning book, but for Ad= a, so that the reader can crystal-clearly see "what the syntax actually doe= s" under the hood. There appear to be 2 types of learners: >=20 > 1) those who love learning opaque black-boxes as opaque black-boxes, embr= acing the opaqueness to the nth degree. (These people are not me, Stan Lip= pman, and apparently you. John Barnes obviously loves voluminous details o= f the opaque black-box, and does an incredible job of revealing what the la= nguage does as an opaque black-box, describing its externally-observable be= havior without significant reference to underlying underpinnings. >=20 > 2) those who love learning how to correctly & smoothly (nonjerkingly) dri= ve an automobile with a manual transmission by first looking at a diagram o= f how the clutch lever actuates a partial-slip/partial-friction plate, then= getting behind the wheel in a parking lot to learn to feather in the slip-= point on the clutch by visualizing in one's mind an imagined-animated varia= nt of the diagram of the manual transmission. Stan Lippman's book above is= firmly in this school of thought. Nancy Leveson wrote an entire book on h= ow an accurately not-too-abstracted & not-too-hokus-pokus mental model is o= ne of the most important aspects of learning a complex system correctly (e.= g., so that the operators of a nuclear-fission power-plant know how the sys= tems work well enough to respond correctly to various emergent scenarios). = This book is about a style of design for a style of deep learning, not a r= ecommendation for your Ada learning and native machine-code object model le= arning (but apropos for validating precisely the style of lucidly-revealing= learning that your original posting is yearning). http://www.amazon.com/S= afeware-Computers-Nancy-G-Leveson/dp/0201119722/ref=3Dsr_1_fkmr1_1?s=3Dbook= s&ie=3DUTF8&qid=3D1378310557&sr=3D1-1-fkmr1&keywords=3DNancy+Levinson+safew= are >=20 > 3) Then there are those people who (very partially, very badly) "learn" n= ew things only by mangled analogy to opaque black-boxes that they already k= now. They, for example, try to learn to drive a manual-transmission automo= bile by only direct & unembellished analogy to a automatic-transmission aut= omobile. Usually, such people with so-impaired thoughts never learn to dri= ve a manual-transmission automobile correctly & smoothly until they disavow= their ignorance (and likely join with us #2-type learners above, when some= #2-type learner teaches how the underlying underpinnings of the clutch act= ually work). Norman Cohen's book partially falls into this rut, and hence = is supplemental reading material to fortify already-partially-learned Ada k= nowledge. (Nancy Leveson's book lambastes this style of shallow learning a= nd the misguided design style that evokes this shallowness.) >=20 >=20 >=20 > And when you get beyond basic Ada knowledge on towards intermediate, you = should start reading sections of the Ada2012 (or Ada2005 or Ada95) rational= e. When you get to intermediate on towards advanced stage of learning, you= should start reading section of the Ada2012 (or Ada2005 or Ada95) annotate= d reference, which is a further-embellished variant of the language standar= d. >=20 > http://www.ada-auth.org/standards/rationale12.html >=20 > and >=20 > http://www.adaic.org/ada-resources/standards >=20 >=20 >=20 > As you read Ada2012, Ada2005, and Ada95 material (perhaps in that reverse= -chronological order), you will see Ada83 (codenamed Green) morph further &= further toward the 2nd-place runner-up in the competition: Red. This is = because Ada95, Ada2005, and Ada2012 was steered by the remnants of the Red = team, after Green team's Jean Ichbiah resigned from his position of Disting= uished Reviewer in protest against Ada95 (or some sanitized rewording there= of). Studying redder-&-redder Ada95-&-onward along with pre-2000 C++ (pred= ating the metatemplate programming filth) are complementary activities, bec= ause redder-&-redder Ada2005-&-onward is what 1990s pre-MTP C++ could have = become.