3 ms·
No. To be useful it needs to be a core language feature.
by ncmncm 5y ago
No. To be useful it needs to be a core language feature.
- pyjarrett 5y ago`Ada.Finalization` is a core language feature, it's a package defined as part of the standard. Like many Ada features, RAII (via Controlled Types) is something you can opt into, such as if you need more than just record initialization.
- ncmncm 5y agoI am corrected.
- WastingMyTime89 5y agoIt is a core language feature. You don't understand what Ada packages are.
- okl 5y agoCore language feature and package are not necessarily the same thing. No reason to bump heads. Instead you could provide a link to the RM: http://www.ada-auth.org/standards/12rm/html/RM-7-6.html http://www.ada-auth.org/standards/12rm/html/RM-7-6.html
- pjmlp 5y agoLanguages like Ada provide hooks, for the runtime and compiler to collaborate together, because safety is more relavant than performance at all expenses. Any variable declared as controlled type will have their "destructor" called just like C++, and that is what matters. Like like RAII doesn't do anything, if the type is heap allocated and due to a bug not deleted or freed(), and someone has to write the destructor code, just like someone has to write the controlled type.
- msla 5y ago> Languages like Ada provide hooks, for the runtime and compiler to collaborate together, because safety is more relavant than performance at all expenses. Does Ada come with optional garbage collection, at least? Memory leaks are a big safety concern, perhaps the biggest in practical code, and IIRC Ada still doesn't have GC "by default" for some unimaginable reason.
- seabird 5y agoThe unimaginable reason is that one of Ada's core competencies is realtime embedded systems. Very often, these don't allocate or free memory ever.
- erik_seaberg 5y agoDon’t a lot of those systems allocate and free slots in large arrays, which is almost as risky?
- seabird 5y agoAda arrays are actual types, they're bounds-checked, the language provides some niceties for indexing, and Ravenscar and SPARK are available. You're going to have less issues with Ada in that case than you are with just about any other language out there.
- pjmlp 5y agoAda 83 had one, however production deployment scenarios never required one so Ada 2005 dropped it, and nowadays thanks to SPARK and controlled types is not required anyway. Additionally Ada controls many types directly like strings and vectors, and storage pools. I recommend the FOSDEM talk about Ada memory management.
- Lucretia9 5y agoIt is a core language feature as of Ada95. Ada, unlike most other languages generates calls into the standard library to implement complex features, controlled types and tasks are two such features. And no, I don't mean generating simple calls to compiler intrinsics.