News for hackers. Stuff that matters.
Re:Six programming languages I’d like to see by thesuperbigfrog on Wednesday July 13, 2022 @08:49AM (#32081866)
>> A serious take on a contract-based language

Ada has design-by-contract as part of the language:

https://learn.adacore.com/courses/intro-to-ada/chapters/cont...

Since Ada is used for safety-critical systems programming you could argue that it is very serious about it.

>> And tool integration! One of the coolest things Eiffel sorta did was use contracts to infer tests. If you have contracts, you can use a fuzzer to get integration tests for free.

How about tools that extend design-by-contract to formal verification?

https://learn.adacore.com/courses/intro-to-spark/chapters/01...

SPARK is limited to a subset of Ada, so it is not without limitations, but it can be very useful depending on what you are trying to do.

Re:Six programming languages I’d like to see by DoingIsLearning on Wednesday July 13, 2022 @10:16AM (#32083053)
If Adacore had published a full featured free compiler for students/universities by the time Ada 95 standard was published, I am sure that Ada could have occupied the space C++ takes today.

Mostly what Ada lacks is not the features but the comunity effect, we saw that when comparing feature parity with C++ and we see that again when comparing feature parity with Rust.

There are a lot of briliant features and tooling in Ada, but unless there is a community effect (or a gigantic industry sponsor e.g. golang) it is difficult to convince people to switch over.

I can't remember who said it so I will paraphrase, the best language/target to program in is whatever your friends/colleagues are using.

Re:Six programming languages I’d like to see by thesuperbigfrog on Wednesday July 13, 2022 @10:33AM (#32083313)
>> If Adacore had published a full featured free compiler for students/universities by the time Ada 95 standard was published, I am sure that Ada could have occupied the space C++ takes today.

Agreed. If there had been more free (gratis) or low-cost Ada compilers at that time Ada would be far less niche than it is today.

There is increased interest in Ada today thanks to Rust. There is also interplay between Rust and Ada/SPARK features with Rust getting some Ada features and SPARK getting some Rust features.

Ferrous Systems is working with AdaCore on the Ferrocene Language Specification to formally document the Rust subset that Ferrocene will use:

https://ferrous-systems.com/ferrocene/

https://ferrous-systems.com/blog/ferrocene-language-specific...

It is exciting to see Rust mature so it can one day be used in safety-critical work.

Re:Six programming languages I’d like to see by the_only_law on Wednesday July 13, 2022 @11:32AM (#32084095)
This seems to be a common theme among certain languages, software, etc. from the 90s. I've heard similar things about Smalltalk.
Re:Six programming languages I’d like to see by igouy on Wednesday July 13, 2022 @05:10PM (#32088809)
Long before the digital era that common theme would have been expressed as —

Don't look a gift horse in the mouth.

Re:Six programming languages I’d like to see by ajxs on Wednesday July 13, 2022 @08:50PM (#32090645)
> If Adacore had published a full featured free compiler for students/universities by the time Ada 95...

Didn't they? I wasn't around then, so I'm working with what information I can find online. According to Wikipedia it was fully validated in 1995[1], and I'm pretty sure it was always a free compiler based on GCC. I think the dust had settled on the battlefield of the language wars long before Ada 95. It was/is still common for European universities to teach Ada as part of the computer science curriculum. That still hasn't managed to give Ada the industry presence it deserves. In my opinion it's by far the superior language. It's just losing out for human reasons.

> ...gigantic industry sponsor e.g. golang...

It had the biggest industry sponsor at one stage: The US Department of Defense. Back in the late 70s, and early 80s when the DoD was directly sponsoring Ada's development, they had incredibly deep pockets. I'd say this is why Ada is so comprehensive today. They had the money, and motivation to design the language by committee down to the most minor details.

[1] https://en.wikipedia.org/wiki/GNAT

Re:Six programming languages I’d like to see by erik_seaberg on Thursday July 14, 2022 @03:39AM (#32093146)
Ada 83 had long had a reputation for stunningly high prices when my first job chose C++ in 1992 (when templates were pretty new and sort-of worked).
Re:Six programming languages I’d like to see by ajxs on Thursday July 14, 2022 @05:46AM (#32093936)
I guess that prior to the FSF releasing GNAT, and the DoD dropping its Ada mandate, compiler vendors had a captive audience, and could charge a serious premium for their software.

I've read that the hardware required to use an Ada compiler was far more expensive than its competitors as well. I've heard more than one person say that this was a serious barrier to its adoption in the wider industry.

Re:Six programming languages I’d like to see by augustk on Wednesday July 13, 2022 @03:42PM (#32087826)
> If Adacore had published a full featured free compiler for students/universities by the time Ada 95 standard was published, I am sure that Ada could have occupied the space C++ takes today.

The same can be said about Eiffel.

Re:Six programming languages I’d like to see by benibela on Thursday July 14, 2022 @08:58AM (#32095483)
Or Delphi
Re:Six programming languages I’d like to see by toolslive on Wednesday July 13, 2022 @12:55PM (#32085400)
Yup, also the commercial ADA IDEs were brilliant, even compared to Borland, but o-so-expensive.
Re:Six programming languages I’d like to see by ainar-g on Wednesday July 13, 2022 @10:15AM (#32083041)
The D programming language, too.

https://dlang.org/spec/function#contracts

Re:Six programming languages I’d like to see by bvoq on Wednesday July 13, 2022 @10:19AM (#32083107)
+1 on D. It even has contracts for members.
Re:Six programming languages I’d like to see by hwayne on Wednesday July 13, 2022 @11:38AM (#32084185)
Forgetting about SPARK was a big whoops for me.

(Lots of formal verification languages are based on contracts, like SPARK, Frama-C, and Dafny. I'm interested in uses for contracts that aren't just formal verification, though!)

Re:Six programming languages I’d like to see by thesuperbigfrog on Wednesday July 13, 2022 @12:18PM (#32084777)
>> I'm interested in uses for contracts that aren't just formal verification, though!

Ada 2012 design-by-contract features aren't just for formal verification, they can be used in a general purpose way similar to Eiffel:

https://learn.adacore.com/courses/intro-to-ada/chapters/cont...

Can you elaborate a bit more about the wanted features for a language with semantic relations?

Re:Six programming languages I’d like to see by hwayne on Wednesday July 13, 2022 @02:49PM (#32087111)
An example off the top of my head would be writing a serializer/deserializer pair and explicitly saying they are inverses of each other, as opposed to having to implicitly say that in a round-trip property test. Another idea would be being able to say that two data representations are isomorphic under a given transformation, so I can define a function for one transformation and call it on the other. I don't know how useful this would be in practice, but it seems interesting to me!
Re:Six programming languages I’d like to see by thesuperbigfrog on Wednesday July 13, 2022 @03:15PM (#32087493)
>> writing a serializer/deserializer pair and explicitly saying they are inverses of each other, as opposed to having to implicitly say that in a round-trip property test.

That capability would be very useful. There are many cases where I have had to define serialization and deserialization functions for numerous objects and had to create so much "boilerplate" unit test code like you describe. It made me wish I was using a Lisp with built-in reader and printer functions.

>> being able to say that two data representations are isomorphic under a given transformation, so I can define a function for one transformation and call it on the other.

This strikes me as very Haskell-ish, but could be quite useful to ensure certain properties or invariants.

Re:Six programming languages I’d like to see by nextstepguy on Thursday July 14, 2022 @02:35AM (#32092730)
I use fuzzing for this. In fact that's the main case I use it for.
Re:Six programming languages I’d like to see by hinkley on Wednesday July 13, 2022 @11:26PM (#32091643)
Better still would be to take progressively typed languages, combined with contracts and property-based testing, and iterate toward a more precise contract for all of your code whenever it became necessary or whenever you got bored.

What are the consequences of deciding that no Foo's are allowed to be red? Hmm, that's interesting/unintended...

The main difficulties with statically typed languages seem to be both 1) quickly arriving at a workable prototype, and 2) dealing with the consequences of regrettable decisions made early on. Those two being in tension contributes a lot of drama, and not just in analysis paralysis.

Re:Six programming languages I’d like to see by dude12344 on Wednesday July 13, 2022 @04:53PM (#32088616)
Also Nim has contracts and supports formal proofing: https://nim-lang.org/docs/drnim.html
Re:Six programming languages I’d like to see by elcritch on Thursday July 14, 2022 @05:42PM (#32101802)
A more practical one might be this contracts library https://github.com/Udiknedormin/NimContracts
Re:Six programming languages I’d like to see by ibains on Wednesday July 13, 2022 @02:03PM (#32086461)
Its not public language, but at Risk Management Systems, I worked on Contract Definition Language- an external DSL for computable insurance, re-insurance contracts. This was used to simulate insurance losses when catastrophic events happen (earthquake, hurricane)
Re:Six programming languages I’d like to see by fernirello on Wednesday July 13, 2022 @03:38PM (#32087784)
Any good reference for that CDL? The idea seems quite useful for what I'm working on. All I found is a wishy-washy doc with poorly chosen examples [0]

[0] https://www.riskdataos.org/html/HelpCenter/Content/CDL/CDL_S...

Re:Six programming languages I’d like to see by occamrazor on Wednesday July 13, 2022 @06:51PM (#32089741)
RMS never played nice on interoperability. I wouldn’t bet on the CDL to become a useful standard, because it is under-powered, under-specified and stagnant.

The “open” alternative is OASIS. Their Open Exposure Data standard [1] is complete and supported by many industry participants. Unfortunately it’s a database based format, rather than a text based DSL, but still betterthan the alternatives.

[1] https://github.com/OasisLMF/OpenDataStandards/tree/master/Op...

Re:Six programming languages I’d like to see by fernirello on Wednesday July 13, 2022 @08:49PM (#32090629)
Thank you! I wasn't aware of OASIS. Reading up now.
Re:Six programming languages I’d like to see by ajdude on Wednesday July 13, 2022 @01:33PM (#32086007)
When I read "contract-based language"I immediately thought of Ada. I could be wrong but I think SPARK is incorporated into the Ada 2022 standard at this point, it could really be thought of as part of the language.

It's the furthest thing from a "dynamically typed language" but it can probably also check the "math" requirement here too.

Re:Six programming languages I’d like to see by miclill on Thursday July 14, 2022 @03:35AM (#32093102)
Fuzion has contracts as well:

https://flang.dev/tutorial/pre_post_conditions https://github.com/tokiwa-software/fuzion

Disclaimer, I work in the Fuzion team.

Re:Six programming languages I’d like to see by kaba0 on Wednesday July 13, 2022 @04:34PM (#32088396)
Java has a similar “extension” as well: https://en.m.wikipedia.org/wiki/Java_Modeling_Language
Re:Six programming languages I’d like to see by tonyhb on Thursday July 14, 2022 @01:01AM (#32092209)
Similarly, Ruby had RDL - which implemented pre/post contracts and type checking prior to Sorbet. It was actually pretty nice, if slow.

https://github.com/tupl-tufts/rdl