Live data from Hacker News

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

iqiipi.com

221–230 of 242 posts

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

#221
post #107

Earlier quoted context omitted.

Ada has borrowed nothing from Modula. There are features common to Ada and Modula, but those have been taken by both languages from Xerox Mesa. The first version of Modula was designed with the explicit goal of making a simple small language that provided a part of the features of Xerox Mesa (including modules), after Wirth had spent a sabbatical year at Xerox. Nowadays Modula and its descendants are better known tha…

Any good reads on Mesa for the interested?

https://softwarepreservation.computerhistory.org/mesa/

Mesa had DEFINITIONS modules, exceptions, subranges, and threads.

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

#222
post #191
post #178

Earlier quoted context omitted.

> The article claims only Ada has true separation of implementation vs specification (the interface), but as far as I am able to reason, also e.g. JavaScript is perfectly able to define "private" elements (not exported by an ES6 module) while being usable in the module that declares them -- if this isn't "syntactical" (and semantical) separation like what is prescribed to Ada, what is the difference(s) the article tr…

It might interest you to know JS has real private fields, formally introduced in ES2022. [1] [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Who wants to bet that GP never reads that link and proceeds to continue to complain about the same outdated JavaScript issues for the next two decades.

Not to mention the fact that GP's issue only matters if you're using classes. You can define module-level variables and simply not export them and they are 100% private. Or, they can just define the variable inside of a function and protect it by a closure. I can't imagine writing multiple paragraphs of complaints about a language that I don't actually understand how to use.

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

#223
post #137

The article states, quoting: "JavaScript's module system — introduced in 2015, thirty-two years after Ada's — provides import and export but no mechanism for a type to have a specification whose representation is hidden from importers." Then: "in Ada, the implementation of a private type is not merely inaccessible, it is syntactically absent from the client's view of the world." Am I missing something -- a JavaScript…

Assuming we’re talking about TypeScript here, because JavaScript doesn’t have exportable types… Any instance in JavaScript, whether or not its type is exported, is just an object like any other, that any other module is free to enumerate and mess with once it receives it. In Ada there are no operations on an instance of a private type except the ones provided by the source module. In other words, if module X returns…

[deleted]

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

#224
post #191

Earlier quoted context omitted.

It might interest you to know JS has real private fields, formally introduced in ES2022. [1] [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Who wants to bet that GP never reads that link and proceeds to continue to complain about the same outdated JavaScript issues for the next two decades. Not to mention the fact that GP's issue only matters if you're using classes. You can define module-level variables and simply not export them and they are 100% private. Or, they can just define the variable inside of a function and protect it by a closure. I can't im…

I've read it and I agree private properties on classes satisfy the requirement. It does allow you to hide implementation details and I was unaware it was added; though with anything JavaScript you can usually find a way around it.

However I don't really want to talk to you. You are rude.

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

#225

I am wondering what the Ada equivalent of affine types is. What is the feature that solves the problem that affine types solve in Rust.

Right from https://www.adacore.com/languages/spark, under the title Memory Safety:

Through a combination of mitigation of dynamic memory usage, borrow-checking analysis and advanced formal proof, SPARK formally demonstrates absence of memory issues such as use after free, access to uninitialized memory or memory leaks and corruption.

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

#227
post #174

Earlier quoted context omitted.

I think you're confusing values with types. JS modules can certainly keep a value private, but there's no way for them to expose an opaque type , because that concept simply doesn't exist in JS. The language only has a few types, and you don't get to make more of them. TypeScript adds a lot of type mechanism on top, but because it's restricted to being strippable from the actual JS code, it doesn't fundamentally chan…

Here's an opaque type wrapping numbers, in JavaScript: class Age { #value; constructor(value) { if(typeof value != "number") throw new Error("Not a number"); this.#value = value; } }

That field is opaque, but the entire type isn’t, no matter what you do. E.g.,

    let x = new Age();
    x.notSoOpaque = 42;
    console.log(x.notSoOpaque);
We can all agree to layer conventions on top of the language so we just don’t do stuff that violates the opacity. But the same is true of assembly language.

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

#228

It'd be a neat trick to have a single unified language which could bridge the gap between software and hardware description languages.

The hardware description languages, even if they have a single language specification, are divided into 2 distinct subsets, one used for synthesis, i.e. for hardware design, and one used for simulation, i.e. for hardware verification. The subset required for hardware synthesis/design, cannot be unified completely with a programming language, because it needs a different semantics, though the syntax can be made somewh…

I read about a VHDL that used DIANA. DIANA was an IR in some Ada compilers; I would imagine that such a common IR would facilitate exactly those test benches with an ease that borders on 'ludicrous'.

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

#230

Ada was also ignored because the typical compiler cost tens of thousands of dollars. No open source or free compiler existed during the decades where popular languages could be had for free. I think that is the biggest factor of all.

Ada’s failure to escape its niche is overdetermined. Given the sophistication of the language and the compiler technology of the day, there was no way Ada was going to run well on 1980’s microcomputers. Intel built the i432 “mainframe on a chip” with a bunch of Ada concepts baked into the hardware for performance, and it was still as slow as a dog. And as we now know, microcomputers later ate the world, carrying alon…

Sun was the first UNIX vendor to introduce the idea to split UNIX into user and developer SKUs, now Sun eventually also had an Ada compiler.

When the companies bought the Solaris Developer tools, that did not include the Ada compiler, that was extra, and wasn't cheap.

Having already paid for C, C++, Assembly, why would anyone pay extra for Ada if not obliged to do so?

Post reply on HN