Live data from Hacker News

Introduction to Ada

learn.adacore.com

181–190 of 193 posts

Re: Introduction to Ada

#181
post #71

Earlier quoted context omitted.

For 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.

I 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.

Ada is older than Unicode..

Re: Introduction to Ada

#182
post #153
post #75

Earlier quoted context omitted.

It actually quite common in ISO processes, there are similar documents for C and C++ language revisions.

There 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 C99: http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10...

Sure, and it is great the decision that ISO Ada took, I was just pointing that there were others available.

I bet most people around here aren't aware of those ones for C.

Re: Introduction to Ada

#183

Maybe 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?

There 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 :-)

Re: Introduction to Ada

#184

Earlier quoted context omitted.

Then (after you make sure you learn enough of another language to not embarrass yourself) be a little bit creative in your resume/CV in order to pass that stupid filter.

(by which I don't suggest to lie, rather to make sure you mention you have some experience in popular language even if your primary job didn't use it. E.g. mentioning the side projects that made you learn C++ will let a recruiter tick that box)

I agree, I see nothing unethical about tailoring your various job-related communications to the type of person you're speaking with. Especially at large firms, HR employees are often quite literally just looking to check off boxes. Obviously you should not outright lie, but we engineering types have a tendency to take these sort of questions too literally.

I use C# at work. I've programmed in Java here and there and have done some small projects in it, but we don't use it at my office. If I apply for a Java job, and the HR rep asks me during the 1st round phone screen if I have Java experience, I'm going to say yes. When I speak with a more technically minded person, I can go into the full story, because they have the background necessary to put it in context.

Re: Introduction to Ada

#185
post #142

Earlier quoted context omitted.

And precisely because it's a niche language, and you have the experience now, you should definitely accept those legacy maintenance requests, as a freelancer, and ask for big bucks. You're wasting opportunities here.

Ada is/was heavily used in the defense/aerospace industry. Most of these legacy maintenance requests come from defense contractors who do not want to pay top-dollar for expertise. They want to put butts-in-seats to soak up billable time and keep the govt customer just content enough not to cancel their contract. So they'll happily hire anyone with a clearance. If they can't find someone who already knows the language…

Here is another example, when evaluating which language to pick for their security critical firmware, NVidia ended up picking Ada/SPARK.

At FOSDEM, Ada room has been a continuous presence for more than 10 years, or even longer, as the language still gets quite some use on high integrity computing around this side of the world.

Re: Introduction to Ada

#186

I'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…

Regarding 'why did Ada not manage to get a significant foothold outside of some small domains?' here are some factors that were relevant at that time (late 80s to early 90s): * The internet was either practically non-existent, or in its infancy. At that time, getting compilers, documentation, and sample code was much more difficult and time consuming. * I recall there being a fair bit of criticism about Ada being 'de…

Turbo C++ 1.0 for MS-DOS could be had for about 100 euros on 1990's money, and it was just a couple of floppies.

No way you could get your hands on an Ada compiler for MS-DOS in a similar way.

Re: Introduction to Ada

#187
post #9

I 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.

Sorry, 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.

Ada 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/r...

Re: Introduction to Ada

#188

Earlier quoted context omitted.

Ada 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 De…

Runtime 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.

Thanks for clarification. Which underlying (type) theory is used in GNATprove?

Re: Introduction to Ada

#189

Does 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 make…

Indeed. 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.

I agree. It's ugly, but there is precedent for CamelCase type names and snake_case function names from Python and Ruby.

Re: Introduction to Ada

#190

Earlier quoted context omitted.

Runtime 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.

Thanks for clarification. Which underlying (type) theory is used in GNATprove?

I don't know details.

GNATprove generates verification conditions (conjectures) from SPARK code and assertations. Then it feeds these verification conditions to proof tool (Why3, Alt-Ergo, CVC4 or Z3).

https://github.com/AdaCore/spark2014

Post reply on HN