Live data from Hacker News

Ada, its design, and the language that built the languages

iqiipi.com

211–220 of 242 posts

Re: Ada, its design, and the language that built the languages

#211

My work on DoD ADA projects tended to focus on DoD STD 2167 (mid to late 1980s). Sadly the review meetings focused on document structure instead of thoughtful software design and analysis. ADA didn't help; it was cumbersome to get working well, and ADA experience in the contracting agencies was low. The waterfall approach made the projects slow to implement. https://en.wikipedia.org/wiki/DOD-STD-2167A?wprov=sfti1

waterfall and ada.

you used to have a thing called preliminary design (i think is specified in 2167A).

with ada, you write all the specs. so, all of the packages procedures / functions and visible variables are declared.

Feed this to the compiler. Does it compile? If yes, then your design is complete.

Implement the bodies during detail design.

Re: Ada, its design, and the language that built the languages

#212
post #200
post #163

Earlier quoted context omitted.

I'd say that is even more so with Rust and Rust got popular in a very short amount of time.

I think this was a genuine generational change. I am pretty sure Rust would never have become popular 20 years earlier because the priorities back then were so different (that was the era of languages like Ruby and Pearl where conciseness and low verbosity were the most valued aspects).

When Ada came out a lot of programmers couldn't even touch type. You're right there's a generational change and a lot of of the Ada stuff won:

    * strong typing
    * lots of annotations
    * keywords over syntax, support for long variable and token names
    * object focus (Ada 83 had some limitations on inheritance so it wasn't OO strictly speaking) 
    * exceptions
    * large standard library
These things were controversial in the 1980s. They are not today.

Re: Ada, its design, and the language that built the languages

#213

I like Ada. I can’t believe this whole discussion about how types are handled missed the entire ML family of languages. ML, Standard ML, Concurrent ML, Caml, OCaml, and more have structural types, supported and enforced by the compiler. Ada has one of the same primary issues as PL/I, PHP, and Perl. As much as one might like it, it’s a huge language with loads of syntax and semantics baked into the core language. The…

Ada isn't a huge language by modern standards. I would say that it's smaller than modern Python and considerably smaller than modern C++. It's also relatively syntax-free preferring keywords and standard library.

Ada came "fully specified" in an era when languages were either not formally specified or were much smaller. C wasn't formally specified, for instance, until 1989 (six years after Ada) and the spec was sparse compared to Ada. For instance, Ada put binary compatibility rules into the language while C's standard didn't worry about ABIs at all. Using two different C compilers could create different ABIs because they aren't part of the language spec.

Re: Ada, its design, and the language that built the languages

#214
post #200

Earlier quoted context omitted.

I think this was a genuine generational change. I am pretty sure Rust would never have become popular 20 years earlier because the priorities back then were so different (that was the era of languages like Ruby and Pearl where conciseness and low verbosity were the most valued aspects).

When Ada came out a lot of programmers couldn't even touch type. You're right there's a generational change and a lot of of the Ada stuff won: * strong typing * lots of annotations * keywords over syntax, support for long variable and token names * object focus (Ada 83 had some limitations on inheritance so it wasn't OO strictly speaking) * exceptions * large standard library These things were controversial in the 19…

I think that is not correct.

One of the big differences between K&R C and C89 is the introduction of function prototypes. Strong typing was certainly considered positive for compiled languages. Of course C is a lot less strict than Ada.

If we compare the Rust subset that has similar functionality as C then there is not much difference. You get 'fn'. The is 'let' but Rust often leaves out the type, so 'int x = 42;' becomes 'let x = 42;' in Rust. Rust has 'mut' but C has 'const'. Rust introduced '=>' and removed '->' from object access and moved it to the return type of a function.

The C language has support for long variable names. Some early linkers didn't, but that's an implementation issue, people were certainly unhappy about that.

C++ started in the 80s. Objects were not controversial back then. The same applies to exceptions.

I don't have a metric for the size of a standard library. For its time, the C library in Unix system had a large number of functions. Later that was split in a C standard part and a POSIX part. But that was for practical reasons. Lot's of non-Unix systems have trouble implementing fork().

I have no clue what you mean with annotations. If you mean non-function annotations along with code, then generally Rust programs don't have those.

Re: Ada, its design, and the language that built the languages

#215
post #200

Earlier quoted context omitted.

I think this was a genuine generational change. I am pretty sure Rust would never have become popular 20 years earlier because the priorities back then were so different (that was the era of languages like Ruby and Pearl where conciseness and low verbosity were the most valued aspects).

not just the priorities, the overall skill and education of programmers. in the 1980/1990's i was a dumb kid. problems of large systems were not in my mind. having to type begin/end instead of {} was, i thought, a valid complaint. with experience, education, and hindsight, most of the advantages of the ada language were not understood by the masses. if ada came out today, it would have taken off just like rust.

I'd say that if the original Ada was introduced at the same time as Rust development started then people would pick Rust. Ada is also a product of its time would have to be modernized quite a bit.

Given how similar the syntax is of C, C++, Javascript, and Go, I think a language with the syntax of Ada would have a hard time.

Re: Ada, its design, and the language that built the languages

#216
post #214

Earlier quoted context omitted.

When Ada came out a lot of programmers couldn't even touch type. You're right there's a generational change and a lot of of the Ada stuff won: * strong typing * lots of annotations * keywords over syntax, support for long variable and token names * object focus (Ada 83 had some limitations on inheritance so it wasn't OO strictly speaking) * exceptions * large standard library These things were controversial in the 19…

I think that is not correct. One of the big differences between K&R C and C89 is the introduction of function prototypes. Strong typing was certainly considered positive for compiled languages. Of course C is a lot less strict than Ada. If we compare the Rust subset that has similar functionality as C then there is not much difference. You get 'fn'. The is 'let' but Rust often leaves out the type, so 'int x = 42;' be…

Exceptions were controversial into the 90s which is why Java went down that whole checked-exceptions rabbit hole. The argument was that an exception was essentially a GOTO (or even COME FROM) which broke functional abstraction.

The Ariane 5 crash involved an exception and that was the central "Ada is unsafe actually" argument from C people.

In fact "exceptions are bad" is so baked into a lot of C people's brains that they left them out of Go!

Short variable names were a technical limitation in early languages but style guides were still arguing against long, descriptive variable names in languages like C into the 2000s.

Objects were also likewise controversial and you can see that in the design of Ada 83 where they were both inspired by OO languages like smalltalk but also hesitant to adopt stuff like inheritance. Inheritance was again, seen as a way to break encapsulation (it kinda is) but also a lot of object implementations were slow and memory inefficient in the 80s. Smalltalk was pretty much the reason why the Apple Lisa failed as a product.

OO became a massive buzzword in the 90s but by that time it had already been around for quite a long time.

By annotations I mean mostly type annotations, of course there's also aspect annotations and other stuff ex: Ada SPARK.

Re: Ada, its design, and the language that built the languages

#217
post #175

I like Ada. I can’t believe this whole discussion about how types are handled missed the entire ML family of languages. ML, Standard ML, Concurrent ML, Caml, OCaml, and more have structural types, supported and enforced by the compiler. Ada has one of the same primary issues as PL/I, PHP, and Perl. As much as one might like it, it’s a huge language with loads of syntax and semantics baked into the core language. The…

As far as I can tell you cannot create your own bounded Integer/Floating point types in any of the ML languages. That's one example of one of the core Ada type features. Most people have never experienced a type system like Ada and you will be surprised by how it helps you write higher quality software that is also more reliable.

My CS classes at uni were based in Ada. I doubt I’ll be surprised.

Re: Ada, its design, and the language that built the languages

#218
post #203

Earlier quoted context omitted.

To be fair, the file-handling is probably the 'crustiest' part of the standard library. (To use the posix-flags, you use the Form parameter.) The best way to use Ada, IMO, is type-first: you define your problem-space in the type-system, then use that to solve your problem. -- Also, because Ada's foreign-function interface is dead easy, you could use imports to handle things in a manner more amiable to your needs/pref…

Yes, agreed on Ada.Interfaces and the FFI, it's one of the best. The only thing "missing" is auto-import of the definitions in C header files (but there be different dragons). gcc -fdump-ada-specs works fine, but it's effectively a duplication of (non-authoritative) information. That's fine if you're targeting one system, but when targeting multiple systems a single "with Interfaces.C.Syscall_H" quickly becomes a maz…

Ok, so the Form parameter is implementation defined; this was to allow the implementations the 'wriggle room' to interface with the host-system.

For GNAT, these two pieces of documentation are instructive: https://docs.adacore.com/live/wave/gnat_rm/html/gnat_rm/gnat... https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gnat_rm/FORM-String... (This second one is older documentation, but illustrates how platform-specific Form parameters could be used.)

    Ada.Text_IO.Create (
        File => File,
        Mode => Ada.Text_IO.Out_File,
        Name => "test.txt",
        Form => "shared=no"
      );
The "maze of alternative package bodies and accompanying conditional compilation logic" is an artifact of C's approach to 'portability' using the preprocessor. Typically, the conditionality should be stable once you abstract it (using the compiler's project-management to select the correct body for a particular configuration) -- As a stupidly trivial example, consider the path separator, for the specification you could have:

    Package Dependency is
       Package OS is
          Function Separator return String;
       End OS;
    End Dependency;
    -- ...
    Package Dependency is
       Package body OS is separate;
    End Dependency;

    -- Windows
    separate (Dependency)
    Package OS is
      Function Separator return String is ("\");
    End OS;

    -- Classic Mac
    separate (Dependency)
    Package OS is
      Function Separator return String is (":");
    End OS;

    -- VMS
    separate (Dependency)
    Package OS is
      Function Separator return String is (".");
    End OS;

    -- UNIX-like
    separate (Dependency)
    Package OS is
      Function Separator return String is ("/");
    End OS;
Then in your the rest of your program, you program against the abstraction of DEPENDENCY.OS (and whatever other dependencies you have, likewise), and thus separate out the implementation dependency.

Re: Ada, its design, and the language that built the languages

#219

I absolutely love this article. When I was a young lad, must have been 20 I came across some programming books, including programming in Ada. I read so much of it but never wrote a line of code in it, despite trying. Couldn't get the build environment to work. But the idea of contracts in that way seemed so logical. I didn't understand the difference this article underpins though. I learned Java and thought interface…

I'm pretty sure you can get the new crate-system to grab/make you a working build. https://alire.ada.dev/

Re: Ada, its design, and the language that built the languages

#220

I would never work on projects that ADA is used for. 1. Would never work on "missile tech" or other "kills people" tech. 2. Would never work for (civ) aircraft tech, as i would probably burn out for the stress of messing something up and having a airplane crash. That said, im sure its also used for stuff that does not kill people, or does not have a high stress level.

It's actually really great for anything where you want to be more safe/correct, like banking... and the `TASK` construct makes it really nice for naturally multitasking situations. A couple of the people in the community are putting together gamedev tools/engine.

Found the link: https://github.com/ada-game-framework
Post reply on HN