7 ms·
What's New in Ada 2022
- MaxLeiter 4y agoExcited to see user defined literals: > In Ada 2022, you can define string, integer, or real literals for your types. The compiler will convert such literals to your type at run time using a function you provide. The example is fun, showing type concatenation in Ada à la JavaScript https://learn.adacore.com/courses/whats-new-in-ada-2022/chapters/user_defined_literals.html#turn-ada-into-javascript https://learn.adacore.com/courses/whats-new-in-ada-2022/chap...
- donatj 4y agoThis just seems dangerous, hard to read, and the total opposite of what Ada is supposed to be about.
- foerbert 4y agoI'm not sure about that. Dangerous, I can see it if it's not implemented reasonably. I'll admit to being less than a stellar ARM reader so I can't say for sure, but I'd bet this was well-considered when it was added. Considering these are literals conversions should be check-able at compile time with some reasonable limitations, and I assume those were added. If I'm wrong though, do let me know. Hard to read? Maybe, but not really? It feels like a 'modern' feature to me in the sense that back in the old days it may have been a little too opaque and required a step more than is ideal to see through it, but with modern editor facilities it seems easily fine. And I don't think it's as bad as tagged types can be in that respect, so I don't see this being a problem. And it will enable some much nicer to use interfaces for libraries, which is one of the few things I've really found myself still fighting in Ada. I don't think it's a general solution to the whole thing, but I'll happily take it.
- MaxBarraclough 4y agoI had the same thought. Ada is famous for its strong typing, i.e. the absence of implicit type conversions of the sort that are such a nightmare in C.
- ajxs 4y ago"Image attribute for any type" is definitely a welcome addition to the language.
- throwaway894345 4y agoHow is the open source development story for Ada these days? Is there good "getting started" material? Are there many projects in Ada? I learned it in college and really liked it, but that was more than a decade ago at a point when there might've been an open source compiler and IDE but it was a pain to use and there weren't many open source libraries anyway. Hopefully things have improved in the interim?
- the_only_law 4y agoThe Adacore tutorials should be able to introduce you to the language if you're familiar enough with programming in general. I did a few AOC problems in Ada and used it a lot.
- thesuperbigfrog 4y agoThe AdaCore Learn site is pretty good to learn / get refreshed on Ada programming: https://learn.adacore.com/index.html https://learn.adacore.com/index.html Alire is a Cargo-like Ada package manager: https://alire.ada.dev/ https://alire.ada.dev/ There has been increased interest in Ada as Rust has grown in popularity. There has even been some synergy and exchange of ideas. Spark got Rust-style ownership of pointers: https://blog.adacore.com/using-pointers-in-spark https://blog.adacore.com/using-pointers-in-spark AdaCore and Ferrous Systems are working together to help Rust get more formalized for future use in safety critical work. Ferrous Systems recently released the Ferrocene Language Specification [2] to formally document the Rust subset that Ferrocene will use. [1] https://ferrous-systems.com/ferrocene/ https://ferrous-systems.com/ferrocene/ [2] https://ferrous-systems.com/blog/ferrocene-language-specification/ https://ferrous-systems.com/blog/ferrocene-language-specific...
- throwaway894345 4y agoWow, this is super cool! Can't wait to dig in! Thanks for the links and information.
- pjmlp 4y ago> Spark got Rust-style ownership of pointers: To be more precise, it has introduced affine types. Rust happens to be the more well know mainstream implementation of them.
- foerbert 4y agoI'm really excited by this! I haven't been keeping up with the 2022 stuff, and I'm quite pleasantly surprised. I will admit to not liking using '@' for notation much at all in any language - never mind Ada - but I'm really looking forward to having a solution for the problem it solves. I do love me some long names, probably even by Ada standards, so it really will be quite nice. I also can't really think of a good viable alternative beyond simply replacing it with a symbol I just happen to find more visually appealing. So... oh well. It'll probably fade into the background soon enough.
- touisteur 4y agoI was also worried about @ but it feels OK after some time. What I really like is the new delta notation. Makes for far more concise but still readable aggregate handling. For once, going in the right direction for readability. Plus, it helps expressing intent and removed some proof burden ("yes I'm passing a whole structure but I'll be modifying only field x and y").
- glacia01 4y agoJust for context, people asked for C "+=" type of assignment since Ada 83. Target Name Symbol solves that. Note that Target Name Symbol is actually more useful than C "+=", since you can do stuff like My_Data (To_Index (1)) := @ * 2 - 3.0 * @;
- deleted 4y ago[deleted]
- wodenokoto 4y agoThe introduction page to the language in general gives a very good sell on where ADA comes from and why it is relevant today [1] [1] https://learn.adacore.com/courses/intro-to-ada/chapters/introduction.html#history https://learn.adacore.com/courses/intro-to-ada/chapters/intr...
- rvieira 4y agoI've never used it, but from the look of the code Ada seems to me such a nice, chill language (for a statically typed one, at least). (Disclaimer: I have a soft spot for Pascal)
- lelele 4y ago>> from the look of the code Ada seems to me such a nice, chill language Looks are deceiving. Ada's verbosity and bureaucracy are mind-numbing. I would still choose it over C and C++, though.
- foerbert 4y agoI felt that way most of my first evening with it. Thankfully I stuck with it, because once I finally got the compiler to accept my awful C-in-Ada-clothes I was hooked. The damn thing worked, first time it compiled, no matter what I threw at it. And that's basically been my experience since, and I don't even need to carry all the paranoia I learned from C and C++ to do it. I can even look up compiler messages if I need to, unlike my debugger state, which is nice. I'm completely convinced it's worth it. What looks like pointless verbosity and sadistic pedantry at first turns into a comfortable security blanket that keeps you aware and in control of what the heck you're even doing. I'd encourage anybody to try it out, just go into it knowing it's kind of similar to jumping into a functional language for the first time. You're going to need to adjust your paradigm a bit to really settle in. Ada is a bit deceptive if you're used to dropping into an imperative language and getting a decent feel for it in an easy afternoon. On the bright side, even if you don't get as hooked as me on it, you might just get a new way to look at programs out of it. Never know when that'll come in handy.
- avinassh 4y ago> Ada's verbosity and bureaucracy are mind-numbing. Can you tell me more? I am not familiar with Ada
- ithkuil 4y agoI'd really love to use ada for some real world application. Is there a gRPC implementation?
- KronisLV 4y agoI feel like most of the older languages are a bit difficult to use in a modern setting. For example, consider how Pascal/Lazarus (a different language, sure, but in similar circumstances to Ada) support MySQL 5.7 at the latest (TMySQL57Connection) and might have certain challenges when you attempt to use them for web development or anything of the sort (REST, SOAP, gRPC, connecting to RabbitMQ etc.). A brief search doesn't turn up any gRPC support for Ada, it feels like using something like Go for components that connect over the network and Ada for actual data processing with interop inbetween might actually be a better setup. It might also just be an uphill battle outside of niche domains where Ada (or even Pascal/Delphi) are established.
- foerbert 4y agoIt depends a lot on what exactly you need or want to use. Sometimes you find something great, or nothing, or something in-between. One nice thing with Ada is how easily it binds to C, and that just got some improvements. Not as easy and nice as somebody else doing it for you, but still. It's something I actually consider, which is more than I can say for any other language. FWIW, in my brief dalliance with Pascal, I got the impression it's a good bit more, uh, fossilized than Ada. I didn't try too hard to find a pulse there at the time, but I don't think I tried much harder with Ada. Yet here I am, shamelessly shilling.
- KronisLV 4y ago> One nice thing with Ada is how easily it binds to C, and that just got some improvements. This is an excellent point and will probably keep lots of similar languages out there viable for a bit longer. For example, I wouldn't start a serious project in Prolog either, but if there's a really good use case for it and there's a way to integrate it with other languages/runtimes, be it C/C++ or anything else, then I might consider it. > FWIW, in my brief dalliance with Pascal, I got the impression it's a good bit more, uh, fossilized than Ada. It depends. It's still a good option for various native GUI software and the occasional bit of number crunching/utilities, especially when used with Lazarus: https://www.lazarus-ide.org/ https://www.lazarus-ide.org/ That said, it's definitely showing its age and the whole Delphi/Pascal divide isn't helping much either. Generally .NET and Go do most of the things I would have considered it for 5-10 years ago, though, maybe only the GUI part isn't entirely solved just yet. I'm not sure why, but most of the newer runtimes/languages don't really have strong built in GUI options, perhaps because developing those and supporting multiple platforms takes a lot of time. I can't stop wishing for something that's as stable as Java Swing or even OpenJFX for something like .NET: Avalonia UI seems like a third party project and using something like Qt/GTK binds isn't always easy to pull off. Just give me a simple and easy to use language that has built in packages for doing most of the common stuff (working with different data formats, network interaction etc.) and has a built in cross platform GUI library, with an IDE that lets you use a designer with drag & drop functionality for laying stuff out, before you connect all of the components in code. Somehow the wisdom of RAD (rapid application development) seems to have waned in the last decade.
- einpoklum 4y agoQ: But why would I want to use Ada at all in the first place? Isn't it just some kind of historical language? A: I wouldn't know personally, but here's what the Ada people say about this: https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Developer/chapters/01_Preface.html https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Devel... the main pitch point is that Ada is useful as a language you can validate code in, and thus more safe in scenarios where errors or bugs are critical and cost human lives. Again, not sure if I buy this (especially w.r.t. to other languages with stronger safety features, not just C/C++).
- pyjarrett 4y ago> Q: But why would I want to use Ada at all in the first place? Isn't it just some kind of historical language? Ada is a peer language of C++, which is still in use today. I did a presentation at FOSDEM giving a high-level overview: https://fosdem.org/2022/schedule/event/ada_outsiders_guide/ https://fosdem.org/2022/schedule/event/ada_outsiders_guide/ Big picture: - straightforward language, once you've read a few hundred lines, you've pretty much seen 90%. - native, no GC, allows customized allocators and other low level control (e.g. alignment, layout) - had a proper package (module) system since inception, which makes creating and using crates for the new Alire package manager very natural - encapsulation and namespacing only at package, not at the type level - you put related types/operations in packages - it's more like writing strongly typed C with namespaces, than writing classes in C++. - no preprocessor or macros - bounds-checked arrays and strings are arrays, and not null-terminated - "access types" instead pointers. Each access type is unique (e.g. you could make two incompatible types which point to the same type) and can be assigned its own allocator. In general, pointer arithmetic prohibited, but can be done (requires built-in library and conversions). - built-in concurrency types - easy binding to C tl;dr It's like a simpler, safer, and more verbose C++, but you get a lot of compiler and runtime error checking for free.
- einpoklum 4y ago> It's like a simpler, safer, and more verbose C++ That might have been a tl;dr around 20 years ago. Now, C++ is very different having progressed along certain trajectories quite a ways. I would not characterize Ada as "An [XYZ]er C++" based on what you wrote.
- krtscrum 4y agoThis was the first language I learned in University. It was taught (maybe still is) in the Computer Science degree from the Polytechnic University of Madrid. It was Ada 95.
- JeanMarcS 4y agoWell, I sure don't remember the version, but I also learned ADA in University (Université Paul Sabatier in Toulouse/France). Back in 1992 !
- deleted 4y ago[deleted]