Author Topic: Learn something for 2025?  (Read 1331 times)

0 Members and 1 Guest are viewing this topic.

Online SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 16097
  • Country: fr
Learn something for 2025?
« on: January 01, 2025, 10:52:52 pm »
Maybe it's time to give it a shot:
https://ada-lang.io/
 ;D
 
The following users thanked this post: DiTBho, eeproks

Offline wilfred

  • Super Contributor
  • ***
  • Posts: 1429
  • Country: au
Re: Learn something for 2025?
« Reply #1 on: January 02, 2025, 02:30:04 am »
For me it would be Simula 67. Anyone know where to download a compiler, specifically for the DEC System10?
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 21662
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Learn something for 2025?
« Reply #2 on: January 02, 2025, 11:26:08 am »
For me it would be Simula 67. Anyone know where to download a compiler, specifically for the DEC System10?

Easier to find a Smalltalk implementation, since there are many available. Better as well, IMHO :)

As for ADA-like languages, I'd go for SPARK or VHDL.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline eeproks

  • Newbie
  • Posts: 7
  • Country: us
Re: Learn something for 2025?
« Reply #3 on: January 02, 2025, 05:40:59 pm »
I always enjoyed Ada, and I find it way more comfortable than the new hotness 'safe' languages, particularly Rust.  GNAT is kinda crufty, but the AdaCore stuff looks much more polished.  The language has also evolved a lot since the Ada-95 days.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 21662
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Learn something for 2025?
« Reply #4 on: January 02, 2025, 06:02:59 pm »
I liked Ada's starting point and attitude, but I was wary of the 1980s Ada. I never had the opportunity to use it in anger. The same can be said of Erlang.

Instead I had to use C, and Rust is shaping up to be preferable to that. (C++: I chose to avoid it, and managed to).

Smalltalk in the 80s was remarkably productive and introduced many seminal advances, e.g. IDEs and JIT runtime environments. Java is its natural successor, with many improvements.

But the Adacore offering does look like it is worth investigating, especially the SPARK subset.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28606
  • Country: nl
    • NCT Developments
Re: Learn something for 2025?
« Reply #5 on: January 02, 2025, 10:12:41 pm »
Maybe it's time to give it a shot:
https://ada-lang.io/
 ;D

It would be cool if you can get it going on a microcontroller without needing to pay license fees for commercial products.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline radiogeek381

  • Regular Contributor
  • *
  • Posts: 134
  • Country: us
    • SoDaRadio
Re: Learn something for 2025?
« Reply #6 on: January 03, 2025, 11:41:53 pm »


For me it would be Simula 67. Anyone know where to download a compiler, specifically for the DEC System10?

I remember waiting in joyful anticipation for the arrival of the DECUS tape with the Simula compiler on it.  It will be in one of the "decus_20tap" files found here: http://www.bitsavers.org/bits/DEC/pdp10/sri-arc/

There may also be a SAIL compiler in there somewhere for the Algol fans.

I wrote a fair bit of Simula code as late as the mid 80's, as it was a simple language for writing discrete event simulators.
 

Online SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 16097
  • Country: fr
Re: Learn something for 2025?
« Reply #7 on: January 04, 2025, 11:01:49 pm »
Maybe it's time to give it a shot:
https://ada-lang.io/
 ;D

It would be cool if you can get it going on a microcontroller without needing to pay license fees for commercial products.

You can. But even with 'alire', setting up the toolchain is a PITA (it's doable, but still annoyingly quirky, probably for lack of traction, so not enough people helping making this available for free).
One can start here: https://blog.adacore.com/ada-on-any-arm-cortex-m-device-in-just-a-couple-minutes

Don't expect it to work right as is described in the tutorial though in "a couple minutes". It probably won't happen. I tried on Linux and was able to get everything working (so up to generating the link­er script and start­up code) except getting the support for ARM cortex eabi, so building the project failed. 'alire' doesn't pull the compiler on its own as is "suggested". Or maybe I missed something. The Ada front-end for GCC for arm-none-eabi is not available directly in my Linux distro and I doubt it is in most others either. I think this can be downloaded from AdaCore, but didn't try going this route yet: https://www.adacore.com/download

Trying Ada for x86_64 targets on desktop is relatively easy though with alire, and can also be done without it, just with the raw GCC toolchain with the Ada front-end. If you're on Linux, many distros have a "gcc-ada" package of some kind.

Building the Ada front-end when building GCC for x86_64 is pretty much merely a matter of adding "ada" in the list of supported languages when configuring it, because the runtimes are already part of mainline. For embedded targets, that's not so and thus it's a royal pain. Too bad.

For those having a working GCC with the Ada front-end ("GNAT") on the desktop, here is a "bit more than hello world" to get you started, and the way you can build it purely with GCC/GNAT, without alire or gprbuild (which is a popular build tool for Ada).

Code: [Select]
with GNAT.IO; use GNAT.IO;

procedure Hello is

type Number is digits 12 range -999_999_999_999.0e999 .. 999_999_999_999.0e999;

function Sum(A, B : Number) return Number with
Pre  => A <= 0.0 and B >= 0.0,
Post => Sum'Result = A + B;

function Sum(A, B : Number) return Number is
begin
return A + B;
end;

begin
Put_Line("Hello World!");
Put_Line("Sum(-2, 5) = " & Number'image(Sum(-2.0, 5.0)));
Put_Line("Sum(2, 5) = " & Number'image(Sum(2.0, 5.0)));
end Hello;

Name the source file "hello.adb".

It contains an example of a function with pre- and post-condition. As you may have guessed, the second call to Sum: "Sum(2, 5)" will fail as it doesn't match the pre-condition.

To build it:
Code: [Select]
gcc -c -Wall -gnata hello.adb
gnatbind hello
gnatlink hello

Note the '-gnata' option that is required to support assertions, which will trigger an assertion at run-time when executing the second Sum(). If you omit '-gnata', the two Sum() will execute ignoring the pre-condition. You can otherwise catch it with an exception block.

Now, apparently GCC doesn't support checking pre- and post-conditions at compile time, which is a bummer. I think Spark does.
Otherwise, you need to use a static analysis tool, such as GNAT SAS: https://docs.adacore.com/live/wave/gnatsas/html/user_guide/introduction.html
I think it's integrated in GNAT Studio, although that'll have to be checked.

And if you prefer using GNAT Studio (AdaCore's IDE), see here: https://github.com/AdaCore/gnatstudio
there are Linux and Windows binaries.
« Last Edit: January 04, 2025, 11:04:10 pm by SiliconWizard »
 
The following users thanked this post: eeproks

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4549
  • Country: gb
Re: Learn something for 2025?
« Reply #8 on: January 05, 2025, 12:27:23 pm »
Building the Ada front-end when building GCC for x86_64 is pretty much merely a matter of adding "ada" in the list of supported languages when configuring it, because the runtimes are already part of mainline.

Ada-core is mainline and it is written in Ada.

You can compile gcc with ada support only if the installed gcc toolchain already supports Ada in the language list.
Code: [Select]
macmini2 # gcc -v
Using built-in specs.
...
--enable-languages=c,c++,fortran
...
By default Gentoo GNU/Linux does not have "Ada" in the enable-languages list, and this means you need a bootstrapper!

which, unfortunately, is no more available for { arm, powerpc, ... }
Code: [Select]
        !system-bootstrap? (
                amd64?
                (
                        ${BASE_URI}/${magic}?filename=${BTSTRP_AMD64}.tar.gz -> ${BTSTRP_AMD64}.tar.gz
                )
                x86?
                (
                        ${BASE_URI}/${magic}?filename=${BTSTRP_X86}.tar.gz -> ${BTSTRP_X86}.tar.gz
                )

Available { amd64, x86 }

I managed to build myself { HPPA2, MIPS32BE, PPC32BE, ... } native toolchains in 2020.
Still in the to-do list { MIPS32LE, PPC32LE, PPC64BE, PPC64LE, ARM5LE ... }

The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4549
  • Country: gb
Re: Learn something for 2025?
« Reply #9 on: January 05, 2025, 12:35:08 pm »
Instead I had to use C, and Rust is shaping up to be preferable to that.

Rust? For which projects do you say it's shaping up to be preferable to the standard C/89/99/...?

C++: I chose to avoid it, and managed to

Yes, I think the same thing. In the end you can evaluate Arduino/C++, a limited use of C++ might make sense.
But don't look at the default libraries because they are not a good example.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4549
  • Country: gb
Re: Learn something for 2025?
« Reply #10 on: January 05, 2025, 12:40:29 pm »
- your "language" myC is nothing but a debug tool for the C language!
nobody will ever use its extensions nor consider it a programming language
... -
the worst thing I was said by the end of the 2024

So true, in the end.

Good luck getting Ada working on MIPS32 and MIPS5++ ...
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 16097
  • Country: fr
Re: Learn something for 2025?
« Reply #11 on: January 05, 2025, 11:47:47 pm »
The tooling is certainly one important issue for anyone who really wants to use Ada. If you're on x86_64, it's not a problem though, and toolchains are available either from AdaCore, or from your Linux distro if you're on Linux. I find it odd that Gentoo apparently doesn't have an existing package for that. Many other distros do. Otherwise, one can download ready-made binaries from AdaCore. They have binaries for RISC-V and ARM apparently too, but I didn't try them. I think these are "native" tools though, meaning, not cross-compilers. Building a cross-compiler for Ada for any other target than x86_64 looks like a bit of a mess. To say the least.

But for those that can use it on x86_64, I say that's worth a try. If just to discover the language, learn something, even if you don't routinely use it afterwards. Judging not just from this thread, but from comments one can hear everywhere, a majority of people seem to have little clue what Ada really is and what it has to offer as a language, with a lot of prejudice. The last standard revision is 2022.

As to using one's own language, it can certainly be a solution in some cases. Being dependent on maintainers from a large organization leads to situations where you're usually out of luck if your target is not supported. Independence is great. It has a cost, though.
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4549
  • Country: gb
Re: Learn something for 2025?
« Reply #12 on: January 06, 2025, 12:03:52 am »
Gentoo has a gnat ebuild, which, as I wrote above, needs a bootstrapper to be compiled because the default gcc toolchain does not have Ada in the gcc-enabled-languages.

I don't know why, already suggested to include Ada, no dice.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4549
  • Country: gb
Re: Learn something for 2025?
« Reply #13 on: January 06, 2025, 12:14:06 am »
Ghdl depends on gnat.

Imagine your boss invests 5k euro in a modern 8 cores PPC64le server, and ... Ops, can't compile ghdl because I don't have a working ada compiler.

Fixed this situation for HPPA2, partially solved for ppc64le.

System76 is now promoting a new arm64le multicore server. Interesting hw, good price. It would be more interesting with ghdl running.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 16097
  • Country: fr
Re: Learn something for 2025?
« Reply #14 on: January 06, 2025, 01:04:45 am »
Gentoo has a gnat ebuild, which, as I wrote above, needs a bootstrapper to be compiled because the default gcc toolchain does not have Ada in the gcc-enabled-languages.

I don't know why, already suggested to include Ada, no dice.

Ah yes, then it's like most other distros. It's just that as a source-based distro, you feel the pain of the build, bootstrapping included. Others with binary packages do the same. The base GCC packages usually don't have Ada enabled. They rarely enable more than C and C++. Then there are additional packages for adding Ada support, or D support. The reason is probably that since there are so few users of Ada, the extra build time (and space for binary distributions) is not warranted for most users. I bet many would get angry on Gentoo if the Ada front-end was automatically built when they emerged gcc.

As to supporting more targets, I don't know how hard it is. Isn't it mainly a matter of writing runtimes? (But that's not a trivial task apparently.)
I've seen that there was a Ada front-end for LLVM, didn't try though. I don't know if it supports more targets. Possibly so? https://github.com/AdaCore/gnat-llvm
« Last Edit: January 06, 2025, 01:08:13 am by SiliconWizard »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf