29 ms·
Introduction to Ada
- TedDallas 6y agoNice documentation. Ada looks a lot like Pascal. It is interesting that SPARK is a subset of subset of Ada.
- non-entity 6y agoPascal-like syntax seemed to have been popular around the time. Outside the Writh languages(Pascal, Modula, Oberon) and Ada, I was reading about CHILL[0] the other day, which is supposedly similar to Ada, but was rather domain specific. Sadly I don't think any modern, free implementations exist. [0]https://en.m.wikipedia.org/wiki/CHILL https://en.m.wikipedia.org/wiki/CHILL
- pjmlp 6y agoPascal is a simplification from ALGOL, so it is actually most ALGOL derived languages. C description tends to refer to ALGOL influence, but it just boils down to structured programming and the data types. Syntax has nothing from ALGOL.
- nsajko 6y agoVHDL has a quite similar syntax, too.
- sguav 6y agoIndeed VHDL is supposedly based as much as possible on Ada syntax. Naturally you would have several differences due to the purpose of the languages, but they are _very_ similar IMO
- Lucretia9 6y agoIt's Pascal inspired but certainly not any of Wirth's syntaxes, like 1/2 line if's, semi colons in weird places making blocks look odd. Ada has a more inclusive syntax, whereby "is" or "begin" and "end" encases what is inside it. Compare Modula's: MODULE X; ... END MODULE X. and Ada's: package X is ... end X; Ada's package feels like one statement containing others, whereby Modula's looks like it ends on the first line.
- mypalmike 6y agoYeah when I learned Ada in college it seemed like it was a better Pascal, including fixing the quirky inconsistent termination.
- EdPF 6y agoThat difference may be due to ";" being considered a statement separator in Pascal, and a statement terminator in Ada. https://wiki.haskell.org/Terminator_vs._separator https://wiki.haskell.org/Terminator_vs._separator
- stolen_biscuit 6y agoAda is one of those languages that I always wish I had a reason to program in
- grawprog 6y agoIt's always had a strange super elite, if you use ada you must mean serious business kind of vibe to it. I guess it's mostly the applications its used in, but the language itself has this strict rigidity to it. It's like the marines or special forces of programming languages or something.
- non-entity 6y agoOutside the unpopular syntax, I've wondered if the goverment / DoD association has scared people away.
- ardit33 6y agoIt was my first language i learned in school... in Radford ( Virginia), before my university switched to Java. ADA was/is popular with defense contractors, so a lot of schools in VA teach it. It is very safe language, being both static typed, and strong typed. It was originally a procedural language, but later they added some OO to it. (to folks that don't know what a imperative language is, think of a language where all methods are like Java Static methods, and you store data in some global space). It can get a bit wordy to program with it, but I also like the lack of '{' bracket use everywhere that C like syntax has. With some modifications, ADA can be transformed into a great/fun language. Anyway, due to its small echosystem and adoption, I think it will remain a 'defense/aeronautic industry' only type of language. This is a simple program, and I think it is fairly elegant, but a bit wordy: with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Check_Positive is N : Integer; begin Put ("Enter an integer value: "); -- Put a String Get (N); -- Read in an integer value if N > 0 then Put (N); -- Put an Integer Put_Line (" is a positive number"); end if; end Check_Positive;
- tlear 6y ago
- Ice_cream_suit 6y agoTheir marketing folks should introduce Ada certification. Many developers would jump through hoops to get any dodgy certification. I have seen dubious FEMA certifications and NFA certifications on some LinkedIn pages.
- non-entity 6y agoThe domains Ada is used in are probably some of the few that would care about some certification too.
- pjmlp 6y agoI have plenty of certifications, not because I value them, rather they are the way many corporate vendors make money with lots of software used by Fortune 500, which use them to gate access to their software. Sales usually are done as X licenses + at least Y certifications.
- khazhoux 6y agoPetty and inconsequential as this sounds, I'm convinced Ada go have gone farther if it didn't have capitals and underscores in all their libs, and long keywords like `procedure`. All that shift-key action makes Ada a physically painful language to work in.
- synack 6y agoOne of the "Steelman" requirements that Ada was built to satisfy was that any program should be able to be represented with a subset of ASCII that would be compatible with the largest range of terminals, teletypes, and punched cards as possible. Less relevant today, but that's why Ada has so many keywords in it's syntax.
- khazhoux 6y agoJust found this: https://blog.adacore.com/a-modern-syntax-for-ada https://blog.adacore.com/a-modern-syntax-for-ada
- synack 6y agoThat was an April Fools' joke.
- khazhoux 6y agoHa, that's what I get for posting stuff without reading it.
- protomyth 6y agoLike all good jokes, there is a grain of truth in it.
- burfog 6y agoSeriously, the curly braces are a huge improvement. That's no joke. The "fn" and ":" are good too. I'm less sure about "include", because I doubt Ada does textual inclusion. If it does, then that is good too. Otherwise, better choices might be: using, use, require, requires, depend, depends, external, library, unit, module...
- synack 6y agoI wish Rust had Ada's type system. It makes a lot of sense to define types specific to your algorithms and have the storage type determined at compile time.
- supplementation 6y agoSorry, can you elaborate? I'm skimming through the documentation and I can't find a section on having "the storage type determined at compile time", except for the section on arbitrary-range integers.
- onox 6y agoAda's type system allows you to separate the high-level specification of a type (which models a problem) and its low-level representation (size, alignment, bit/byte order, etc.). The language also requires explicit conversions for two different types even if their underlying representation on the hardware is the same. Example 1: type Byte_Count is range 1 .. 4 with Static_Predicate => Byte_Count in 1 | 2 | 4; -- Aspects are Ada 2012 type Component_Count is range 1 .. 4; V1 : Byte_Count := 3; -- compiler error: expression fails predicate check V2 : Component_Count := V1; -- compiler error: requires explicit conversion For these two types I'm not really concerned about how they are represented by the hardware, but I could if I needed to. Example 2: Extra constraints added to some pre-defined types: subtype String8 is String with Dynamic_Predicate => String8'Length <= 8; subtype Even_Integer is Integer with Dynamic_Predicate => Even_Integer mod 2 = 0, Predicate_Failure => "Even_Integer must be a multiple of 2"; Example 3: Use big-endian for some network packets: type Packet_Type is record Header : Header_Type; Data : Data_Type; end record; Low-level representation (placed in the private part of a package spec): for Packet_Type use record Header at 0 range 0 .. 255; Data at 0 range 256 .. 1855; end record; for Packet_Type'Bit_Order use System.High_Order_First; for Packet_Type'Scalar_Storage_Order use System.High_Order_First; for Packet_Type'Size use 232 * System.Storage_Unit;
- brmgb 6y agoAda allows you to customize the size and memory representation of a lot of type. It's called representation clauses [1]. It can be very useful if you want to exchange data structures with a different language without marshalling. I have used it to interopt with C++. It can be quite nice and we had some very unpleasant packing bugs in the C++ code which were caught thanks to Ada good error messages. Overall, working with Ada was quite pleasant. The type system is nice. The module system is nice. Writing concurrent code was really nice. The Algol like syntax somewhat reminded me of my day working in Ocaml. I did miss true variant types however. [1] https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/representation_clauses_and_pragmas.html https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/r...
- non-entity 6y agoI've been intrigued by Ada for some years, but never really dived into it too much. I dont mind the language, but the tooling always seemed weird to me and it feels like any real world use of the language seems like its been relegated to legacy maintenance. Most of the time if I see Ada in a job description, it makes it seems like its something that's nice to know because there's a sliver of a chance you might have to rewrite or modify it, but majority of work will be done in something like C++, which is a shame.
- johnisgood 6y agoMy comments on Ada: https://news.ycombinator.com/item?id=23808305 https://news.ycombinator.com/item?id=23808305
- deleted 6y ago[deleted]
- pjmlp 6y agoJust as a heads up that although Ada Core is the most well known and FOSS friendly Ada vendor, there are still around 5 compilers vendors.
- dwheeler 6y agoThe GNAT Ada compiler is open source, generates good code, and has really good error messages. There's a story behind its development, which I tried to summarize here: https://dwheeler.com/essays/make-it-simple-dewar.html https://dwheeler.com/essays/make-it-simple-dewar.html
- e12e 6y agoThank you for posting that. Especially interesting in light of Walter Bright's comment(s) in this thread. I didn't quite understand why someone who wrote a c++ compiler would think Ada was insurmountable - this adds some context. In my nativité I'd have guessed that writing an Ada compiler was on par with Pascal (but with more types and stuff). This is probably the same (wrong) reasoning by which Mr Bright tricked himself into writing a c++ compiler ;) Ed: note, I was introduced to Object Pascal - not plain Pascal - so that's the comparison I'm alluding to.
- Lucretia9 6y agoOh Ada is so much more complex than Pascal. I think getting something with the numeric types is doable in a smaller timeframe, the OO, tasking stuff would be much harder. You could knock out an object-Pascal / Oberon compiler in a matter of weeks imo.
- pjmlp 6y agoOberon and Object Pascal as initially introduced yes. On their most up to date variants, Active Oberon and Delphi/Oxygen/FreePascal it will take much longer than just a couple of weeks.
- neverartful 6y agoI had always heard that PL/I and Ada are much more difficult languages for producing a suitable compiler.
- dwheeler 6y agoAs noted in the article I posted earlier, Ada isn't that difficult a language to compile, it's just that early Ada compiler developers assumed it was hard, so they made it hard. The GNAT Ada compiler is OSS, so you can look it yourself. It has a hand-crafted lexer (for speed), but otherwise it's not complex. It uses recursive descent (for good error messages), but lots of compilers do that & it's not hard to understand either. (If you don't understand creating a recursive descent parser then you'll need to learn that, but it's a one-time cost to learn about that). Ada is really easy to parse compared to C++. There aren't the backwards-compatible-with-C historical stuff that makes things complicated. Ada has built-in support for tasks, including safe communication mechanisms for them. Many other languages today do too, so that's not such a big deal today. Generating very good code is hard in any language. GNAT "cheats" by building on gcc, which already works on this problem. GNAT parses source code & then generates the internal structures needed for gcc to do its thing. Many language implementations parse & then pass things on to an infrastructure (gcc or LLVM), so that's not unusual. PL/I is complicated in part because of its baroque "automatically figure out all the conversions" rules. Ada in general makes you be explicit about types, so that is a non-issue.
- pietroppeter 6y agoVery nice introduction. For those interested in a modern language that has a strong type system as in Ada and it is also growing safety capabilities à la SPARK, you might want to check out Nim. https://nim-lang.org/ https://nim-lang.org/ https://nim-lang.org/blog/2020/06/08/static-analysis.html https://nim-lang.org/blog/2020/06/08/static-analysis.html
- wirrbel 6y agoAfter having seen the C++ guidelines of the automobile industry i wish we'd just use Ada more..
- Jtsummers 6y agoI spent a lot of time circa 2009/2010 teaching myself Ada for similar reasons. I work in avionics systems (or used to, present job is not) and Ada is grossly underutilized. I’d be willing to wager half the bugs that I saw make it to the testers or, worse, the field would not have happened if we’d used Ada (and used the type system properly). And these days, using Spark, even more bugs could be detected before compilation even succeeds. But no one wanted to use it at any of my jobs, and that knowledge has mostly atrophied from disuse.
- zeroc8 6y agoUsing Spark contracts to specify and verify low level requirements should be a huge time saver. I too don't understand why everybody seems to use C/C++ nowadays. I guess commercial Ada is just too expensive.
- deleted 6y ago[deleted]
- bluGill 6y agoThere is a group trying to bring contracts to C++, and Spark is something they have looked at for guidance. I'm not sure of the progress, last I checked there were conflicts on how to use them. That is the compiler guys wanted to use the contract to optimize farther, while the safety guys said that is insane: you don't know if the contract is proved.
- EdPF 6y agoHere's a 1/2 hour webcast on the interaction of programming language and software lifecycle costs. Not too old. https://www.vdcresearch.com/_documents/briefs/IoT/18-Controlling-Costs-Webcast.mp4 https://www.vdcresearch.com/_documents/briefs/IoT/18-Control... Here's extensive research results based on function point analysis. http://www.ifpug.org/wp-content/uploads/2017/04/IYSM.-Thirty-years-of-IFPUG.-Software-Economics-and-Function-Point-Metrics-Capers-Jones.pdf http://www.ifpug.org/wp-content/uploads/2017/04/IYSM.-Thirty... Whole lotta' mything going on!
- WalterBright 6y agoI always liked Ada, from my first reading around 1980 of MIL-STD-1815. Many of D's features were inspired by Ada.
- Lucretia9 6y agoShame you didn't write an Ada compiler, the docs were available. It would've been interesting to see what you would've come up with. It'd still be interesting I think. A lot of the older closed compiler are still based around the program library idea which is no longer required, considering GNAT is file / project based. I've only used GNAT and have no idea how the program library versions work.
- WalterBright 6y agoI still have a copy of the original Ada MIL spec.
- Lucretia9 6y agoI think someone was looking for that. You don't have a copy of the other languages do you? Red is online, but blue and yellow are not.
- WalterBright 6y agoI bought the original spec MIL-STD-1815 10-December-1980 back in 1980 or so, but it didn't survive a purge I made when moving. A couple years ago I went looking for it. It's not online anywhere, but I found an old library copy for sale and snapped it up. It's green, and I don't have any of the other specs. I'm sad I also purged my DECSystem-10 "Orange Book". I've never been able to find a replacement anywhere.
- jhalstead 6y agoDo you remember if the nickname was "Orange Book" or was it "phone book"? I didn't see the former when searching for more information, but the latter was referenced here [0]. If it's actually "phone book", then [1] seems promising. [0] http://www.columbia.edu/cu/computinghistory/pdp10stuff/ http://www.columbia.edu/cu/computinghistory/pdp10stuff/ [1] http://www.bitsavers.org/pdf/dec/pdp10/TOPS10/1972_PDP-10_Users_Handbook/ http://www.bitsavers.org/pdf/dec/pdp10/TOPS10/1972_PDP-10_Us...
- aronpye 6y agoWhat an ugly, unintuitive language. Are there any benefits to Ada over something like c++?
- Lucretia9 6y agoYou'd spend about 1000th of the time in a debugger compared to modern C++ and about 1000000th the time compared to C.
- thesuperbigfrog 6y agoAn advanced type system: https://learn.adacore.com/courses/intro-to-ada/chapters/strongly_typed_language.html#derived-types https://learn.adacore.com/courses/intro-to-ada/chapters/stro... Built-in concurrency and concurrent-safe data passing: https://learn.adacore.com/courses/intro-to-ada/chapters/tasking.html https://learn.adacore.com/courses/intro-to-ada/chapters/task... Design-by-contract programming: https://learn.adacore.com/courses/intro-to-ada/chapters/contracts.html https://learn.adacore.com/courses/intro-to-ada/chapters/cont... Provably safe programs if you use the SPARK subset of Ada: https://learn.adacore.com/courses/intro-to-spark/chapters/03_Proof_Of_Program_Integrity.html https://learn.adacore.com/courses/intro-to-spark/chapters/03...
- msla 6y ago> An advanced type system: Not compared to Haskell. Ada has a strong type system for an Algol-derived language, but the world has moved on without it in terms of type systems in general.
- Jtsummers 6y agoAlmost every language has a less advanced type system than Haskell. But compared to most mainstream languages, Ada's type system is still quite advanced.
- msla 6y agoSo Ada's type system is better than an "average" language but not as good as a good language. Therefore, if I'm looking to trade up from an "average" language, it's in my interest to leapfrog Ada and go with a good language.
- 1vuio0pswjnm7 6y agoThe original open source Ada83 compiler that grew into GNAT for Ada95 was written in setl. The author of GNU setl has said he would release the source, but we're still waiting. There are binaries here: https://setl.org/setl/bin/ https://setl.org/setl/bin/ (No NetBSD ones though, forcing us to use emulation) Ada reminds me of spitbol, and setl can be written in spitbol. R K Dewar's spitbol, written in a portable assembly language called MINIMAL, has been open-sourced. There's a version of setl written in spitbol, too. Hopefully we will have the source for setl one day. The author's dissertation on setl is a favourite of mine: https://web.archive.org/web/20060823004442if_/http://www.cs.nyu.edu:80/~bacon/phd-thesis/diss.pdf https://web.archive.org/web/20060823004442if_/http://www.cs.... See also https://web.archive.org/web/20100217021505if_/http://www.setl-lang.org:80/docs/setlprog.pdf https://web.archive.org/web/20100217021505if_/http://www.set...
- Rochus 6y agoInteresting. Never heard of SETL before. There is even a Wikipedia entry: https://en.wikipedia.org/wiki/SETL https://en.wikipedia.org/wiki/SETL. References 1 and 2 confirm that it was indeed used to implement the first validated Ada compiler. Didn't know that.
- 1vuio0pswjnm7 6y agoAnother factoid: It was actually SNOBOL (later SPITBOL from Dewar, who was a founder and president of Ada Core), not AWK, that was the first language to offer "associative arrays", which are simply called "tables".
- Rochus 6y agoI like the story why they renamed from SEXI to SNOBOL, see https://en.wikipedia.org/wiki/SNOBOL#Naming https://en.wikipedia.org/wiki/SNOBOL#Naming.
- guerby 6y agoOne thing I liked about Ada is that the authors of the language also wrote why they choose things the way they are, what was rejected, etc... Their is a document about this called "The Ada Rationale" available on the web: http://www.ada-auth.org/standards/rationale12.html http://www.ada-auth.org/standards/rationale12.html I did contribute the HTML version of the Ada 1995 Rationale (first language revision) back in the day: https://www.adaic.org/resources/add_content/standards/95rat/rat95html/rat95-contents.html https://www.adaic.org/resources/add_content/standards/95rat/...
- pjmlp 6y agoIt actually quite common in ISO processes, there are similar documents for C and C++ language revisions.
- dwheeler 6y agoYes, but many ISO documents are not publicly available (they're paywalled instead, even though ISO doesn't pay the authors). The Ada rationale is publicly available, so anyone can see exactly why various decisions are made. That's useful for someone using Ada (obviously), but it's also useful for people designing any other programming language... you can often learn about a craft by learning about why people made various decisions.
- pjmlp 6y agoHere is the one for C99, http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10...
- _kst_ 6y agoThere are published rationales for C90 and C99, but not for C11. (Actually the original rationale is for ANSI C89, which differs from ISO C90 mostly in the way the sections are numbered.) C89: https://www.lysator.liu.se/c/rat/title.html https://www.lysator.liu.se/c/rat/title.html C99: http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10...
- guerby 6y agoAnother thing is that the language backers made sure the ISO standard was available at no cost which was not obvious in the eighties so students could read it. https://en.wikipedia.org/wiki/ISO/IEC_8652 https://en.wikipedia.org/wiki/ISO/IEC_8652 I was told that the Ada guyes fought with ISO to have a per paragraph numbering to ease translations and references, ISO (at the time, don't know now) was line numbered, but they lost.
- meej 6y agoI got to use Ada for eight months in 1997, on a co-op at Rockwell-Collins in their General Aviation department. I learned and wrote a lot of Ada and I loved it. When I had to go back to school in the fall, I was no longer interested in writing C++ and it kind of bummed me out to have to use it again.
- pjmlp 6y agoIronically what got me into C++ in 1993, was being able to make use of a type system similar to Turbo Pascal's one that I got to love (I was using TP 6/TPW 1.5 by then), alongside "cheap" compilers and widespread availability on home computers. I just used C for a couple of months before being given a copy of Turbo C++ 1.0 for MS-DOS, and since then I only used C when the option was outside of my control. It already felt primitive in 1992/1993 vs the alternatives, and so far C17 has hardly changed in that regard.
- rbanffy 6y agoI had a similar experience. I learned Smalltalk and then, when I tried to learn C++, I saw the bit-shift operator be used to output stuff to the terminal. It took me 8 years to get over the initial disgust and learn C++.
- Lucretia9 6y agoThere are many industries that could benefit from Ada, but one in particular is the games industry, but then, they'd also have to start designing stuff, stop feature creep and changing every little thing all the time, and crunch.
- deleted 6y ago[deleted]
- niho 6y agoAda was the first language I learned at university back in 2003 (I had previously taught myself C/C++, Assembler and VB). It had a huge impact on me and influenced my entire career and how I approach software engineering. These days languages like Erlang and Haskell are carrying on some of the ideas (modularity, type safety, concurrency, etc.) in more modern incarnations. But there is still something special about Ada.
- guerby 6y agoFun fact GNAT (GCC Ada front-end) will use a biased representation for range type when packing tight: with Ada.Text_IO; use Ada.Text_IO; procedure T is type T1 is range 16..19; type T2 is range -7..0; type R is record A : T1; B,C : T2; end record; for R use record A at 0 range 0 .. 1; B at 0 range 2 .. 4; C at 0 range 5 .. 7; end record; X : R := (17,-2,-3); begin Put_Line(X'Size'Image); -- 8 bits end T;
- henrikeh 6y agoFor those not familiar with Ada and bit representations, the compiler is exploiting the fact that types in Ada can have constraints that limit their size. T1 is a type of integer ranging from 16 to 19 (inclusive). Thus, it can only be four distinct values (16, 17, 18, 19). Two bits is enough to represent these four distinct values and thus the binary representation of the type (in record R) can be reduced to 2 bits.
- guerby 6y agoI heard that the only reason Ada had an "Integer" type as opposed to just have range types with user provided bounds was because of String index needing it - String is just a standard array of character in Ada.
- renox 6y agoAda is older than Unicode..
- noneeeed 6y agoThe type system in Ada was always so nice to use, and it was incredibly useful when using SPARK to really constrain the bounds of your types and make the runtime exception freedom proofs easier. I miss working in Ada, but I don't really miss working on those kinds of projects.
- the_duke 6y agoI'd be very interested in someone with substantial experience in Ada/Spark providing some insight: * Why did Ada not manage to get a significant foothold outside of some small domains? * What's great, what's not so great about it? * How "modern" does the language feel, including the tooling, documentation, etc? Specifically Spark 2014. ( I see a LSP server and VSCode plugin, for example) * Spark2014 seems to be open source, with a GPLv3 license. Is this what most companies use, or are there significant closed source parts that must be bought? Are most companies still on older versions? * What other languages are most similar?
- Lucretia9 6y agoI don't know SPARK and haven't touched it, but...I had to learn Ada9X at uni in 1995, I've been using it for the last 15 years and have been on #Ada on Freenode for longer. 1) The creator of #Ada, caracal, once said that when he was in the army, there were two groups of people: i) those who were interested to learn about Ada and ii) those who were totally against it without having seen any of the language at all. The second group were the ones who, when they came around with the green manuals, just refused to even read them. 2) I went back to Ada after burning out in a shitty games company, essentially sitting in a debugger for 19 hours straight isn't good. The only time I have to use a debugger is when using pointers, Ada allows you to avoid pointers for the most part. Ada's type system, data modelling, it's unparalleled anywhere else ever. There's not enough people working with Ada in OSS. It's easy to burn yourself out on a big project sometimes. 3) Very modern, the docs are good, but the tooling is lacking. But then I come from a time of command lines and no package managers.
- thesuperbigfrog 6y agoAlire is an Ada package manager built around the GNAT toolchain: https://github.com/alire-project/alire https://github.com/alire-project/alire I have not used it, but it looks promising.
- Lucretia9 6y agoCurrently it's built around gnat, not looked at the source, but I hope they've built in portability across compilers.
- galacticdessert 6y agoTotally unfamiliar with Ada, but reading below it seems that type safety and concurrency are big selling points of it. In which way would this better than a modern functional language, say F#?
- MaxBarraclough 6y agoLooks like a good tutorial, but it doesn't go into much depth on memory-management. The More About Types section has a little. It mentions that automated reference-counting is available through the GNATCOLL library, which seems to have since been broken apart into three different packages [0], so it now resides in gnatcoll-core [1]. Can anyone comment on memory-management in Ada? [0] https://github.com/AdaCore/gnatcoll https://github.com/AdaCore/gnatcoll [1] https://github.com/AdaCore/gnatcoll-core/blob/master/src/gnatcoll-refcount.ads https://github.com/AdaCore/gnatcoll-core/blob/master/src/gna...
- Raphael_Amiard 6y agoHello Max! We agree that it's a hole in the current curriculum, that we intend to fill at some stage with the advanced lessons. State of memory management in Ada is: - You have a lot of facilities to stack allocate/not heap allocate tons of stuff that you would heap allocate in pretty much any other low level languages. - When that doesn't cover you, in Ada you're basically at the level of C++: You have refcounted pointers, unique pointers (which are enforced via limited types) in GNATCOLL, managed containers in the stdlib, and manual memory management. You have storage pools which, with the 2012 additions, are roughly similar to custom allocators in C++/Rust. - In SPARK we have ownership pointer that are roughly similar to pointers in Rust: https://blog.adacore.com/using-pointers-in-spark https://blog.adacore.com/using-pointers-in-spark Anecdotally, I have a friend/colleague working on a fun side project, https://github.com/Roldak/AGC https://github.com/Roldak/AGC, meant to plug a garbage collector into Ada, since the language is much more amenable to that than C or C++. (completely prototype/for fun project, hence why I'm not including it in the "serious" options at your disposal above)
- MaxBarraclough 6y agoGreat answer, thanks.
- pjmlp 6y agoBesides the sibling comment, there is a FOSDEM talk about it. https://archive.fosdem.org/2016/schedule/event/ada_memory/ https://archive.fosdem.org/2016/schedule/event/ada_memory/
- deleted 6y ago[deleted]
- jcadam 6y agoI spent about 4 years of my early career working with Ada in the aerospace industry (specifically, I worked on the GPS satellite program). It was rather career-limiting because I ended up as a young engineer with a lot of experience in an extremely niche language. It took a while, but I was finally able to escape and start working with more modern technology (involved a lot of self-learning on side projects and finally finding a rare employer that believed engineers are capable of learning new skills). I do occasionally get emails from recruiters looking for Ada programmers - they're exclusively for legacy maintenance. Fortunately, I'm in a position to ignore them now :) As a language, Ada isn't bad. I'd prefer it over C++ or Golang for sure, but there just isn't enough interesting work going on using Ada to warrant investing time in learning the language.
- bitwize 6y ago> their just isn't enough interesting work going on using Ada to warrant investing time in learning the language. You can help change that -- by doing interesting work! The nice thing about open source and self-directed projects is that you can use what you want based on its own merits, and leave bandwagoneering for when you have to find a job.
- Lucretia9 6y agoI've done that.
- jcadam 6y agoI don't know, if I'm trying to create an open-source project with the intent of making something that becomes useful and popular, I'm not sure I'd want to artificially limit the number of potential contributors by picking an obscure language. That said, I don't really have a strong enough desire to get back into Ada anyway. I'm a big fan of Clojure and Kotlin at the moment :)
- tester34 6y agoIt sounds like instead of using he right tool to solve the problem, you create the problem to use the tool :o
- deleted 6y ago[deleted]
- clircle 6y agoI was a freshman CS student in 2007 and this was the language that I learned in CS 101. I wonder how common that was. Frankly, that was my first exposure to programming, and I thought the language was strange enough and the prof wasn't good enough, so switched majors. Still the only formal programming education I've had.
- Kototama 6y agoI like that the primitives types are so refined in Ada. That's something that is missing in a lot of languages. You can define subtypes or different types and ranges from the integer type for example. A few years ago, I wrote a little blog entry about it: https://www.dialectical-computing.de/blog/blog/2011/05/08/dear-language-designers-do-not-forget-ada/ https://www.dialectical-computing.de/blog/blog/2011/05/08/de...
- mayama 6y agoAny recent popular languages with similar support for types of Ada? Is such type system being costly to implement the reason not many other languages pick up the feature?
- Kototama 6y agoAda is peculiar because the checks for the ranges are done at runtime. This mean you need a small runtime. A lot of languages are inspired by C and C++ and the types are simple in these languages so it could be an explanation. Haskell has `Numeric.Natural` but I don't think you can define an integer constrained to a range. It probably goes beyond what the type system can do (statically). I think it's possible with Dependent Types (in Idris) but this is rather new.
- Lucretia9 6y agoYou only need to go on programming languages or compilers subreddits to see that they only seem to know C or C++, due to the "hey, I made a language and it's based on C(++), only btter." I look and it's basically the same mistakes each time, the for loop, the basic data types, etc.
- xentropy 6y agoRuntime checks are compiler implementation issue rather than language issue itself. With static analysis compiler could eliminate redundant runtime checks. For example, if SPARK (Ada subset) is used and absense of runtime errors can be proved by GNATprove, then runtime check generation can be disabled in Ada compiler.
- throwaway889900 6y agoShame that the tools for Ada go from bad to worse even in the best case scenario. It's no wonder nobody really wants to use the language when other languages have all sorts of tools and ecosystems around them that make everything a breeze.
- gmfawcett 6y ago> Shame that the tools for Ada go from bad to worse even in the best case scenario. What does that sentence even mean?
- andi999 6y agoMaybe somebody remembers better, but I remember when I looked into it over a decade ago, GNAT had the problem that it didnt have a GNU library linking exception or so. Does anybody remember the history? Also I still find the whole environment confusing for windows. GNAT Programming Studio IDE seems to be useful, but what ballpark is the pricing for the commercial version. Anybody has an idea?
- renox 6y agoThere are several GNAT compiler versions the FSF version has a linking exception, the Adacore pro version requires a commercial license. IMHO they should have renamed the FSF GNAT (1) to clarify the situation.. 1: I suggest FAda :-)
- cpeterso 6y agoDoes any other programming language use “Ada case” identifiers (mixing uppercase and underscores like "XML_HTTP_Request") instead of camel case ("XMLHTTPRequest" or "XMLHTTPRequest") or snake case ("xml_http_request")? Ada case avoids the ambiguity of lowercasing acronyms or smooshing together of words. (Yes, I know the actual capitalization of my example identifier in JavaScript is "XMLHTTPRequest". That’s what makes it such a good example. :)
- atombender 6y agoIndeed. It always bugged me that languages like Rust chose snake_case for lowercase identifier, but CamelCase for the rest. Surely it should be Camel_Case.
- cpeterso 6y agoI agree. It's ugly, but there is precedent for CamelCase type names and snake_case function names from Python and Ruby.
- jayp1418 6y agoBTW this satellite was launched yesterday coded in ada : https://blog.adacore.com/using-ada-for-a-spanish-satellite-project https://blog.adacore.com/using-ada-for-a-spanish-satellite-p...
- jayp1418 6y agoInteresting project : https://github.com/jrmarino/draco https://github.com/jrmarino/draco
- mdg99 6y agoMaybe niche is ment for systems that should work properly. The following URL could give an idea: https://www2.seas.gwu.edu/~mfeldman/ada-project-summary.html https://www2.seas.gwu.edu/~mfeldman/ada-project-summary.html
- mdg99 6y agoMaybe niche means systems that should work properly. This URL might give an idea: https://www2.seas.gwu.edu/~mfeldman/ada-project-summary.html https://www2.seas.gwu.edu/~mfeldman/ada-project-summary.html