[HN Gopher] Show HN: Getada: rustup-like installer for Ada's too...
___________________________________________________________________
Show HN: Getada: rustup-like installer for Ada's toolchain/package
manager
One of my goals with Ada is to have a one-liner copy-paste terminal
command for people to install Ada so they can get to coding in just
a few minutes. After extensive testing I feel like it's ready for
general release[1]. Getada was inspired by Rustup[2] and aside
from the init script is written entirely in Ada. It's completely
open source and you can check out the readme and code on github[3].
It currently supports all non-windows platforms that Alire has an
official release for, which at present is Linux (glibc) and MacOS.
If you try running it on an unsupported platform, it tries to point
you in the right direction. For example, you can install Alire on
windows with an already-existing installer. It downloads the
latest version of Alire[4] (Ada's toolchain and package manager,
similar to Cargo) for your platform as a zip file to a temporary
directory and then extracts it to a binary directory. By default
the temporary directory (configure with "-t /directory" or "--
tmp=/directory") defaulted to $TMPDIR or /tmp. The config directory
is ~/.getada (change via "-c /directory", "--cfg=/directory", or
$GETADA_CFG), and the alr and getada binaries go in ~/.getada/bin
(configure with ""-b /directory", "--bin=/directory", or
$GETADA_BIN). It also tries to add the file to your path by
dropping a "env.sh" file into ~/.profile/ (disable with -p or --no-
path). If you don't allow executables in temporary or home
directories, you can change all of these via environmental
variables or passing parameters. You can remove it all by running:
getada --uninstall Now you can create a brand new Ada project
with: alr init --bin my_project (How to use Alire[5] for more
details) Since one of the biggest complaints about Ada is getting
the toolchain [6], I hope this can solve a lot of problems for
newcomers to the language. [1] https://www.getada.dev [2]
https://rustup.rs/ [3] https://github.com/aj-ianozi/getada [4]
https://alire.ada.dev/ [5] https://www.getada.dev/how-to-use-
alire.html [6] https://programming.dev/comment/9438211
Author : ajdude
Score : 156 points
Date : 2024-04-23 14:26 UTC (8 hours ago)
(HTM) web link (getada.dev)
(TXT) w3m dump (getada.dev)
| glass-z13 wrote:
| I don't know if it's the algorithm but for the past few months
| i've been seeing bits and pieces in random places about ada. Is
| there a reason the language is seeing more traction lately? I
| would assume the whole White House "approved" languages had
| something to do with it
| ajdude wrote:
| Ada's been steadily making a reassurance I think since safer
| languages like Rust had started to gain traction. It appeared
| for the first time ever on the stackoverflow survey for
| example.
|
| It used to be hampered down by confusing licenses but around
| 2021 those constraints were lifted when Adacore's "GNAT
| Community Edition" was retired. This was around the time Alire
| (works similar to if you combined Rustup with Cargo) came on
| the scene which meant getting the FSF version of the compiler
| was as trivial as running "alr toolchain --select".
|
| The most recent standard came out in 2022 along with a more
| centered community. Most of the ada community was living in a
| newsgroup (comp.lang.ada) until a year ago, and now ada-lang.io
| is gaining a lot of traction.
|
| Then Alire 2.0 just recently came out which made everything
| even more streamlined.
|
| Ada has been my favorite language for years, so I'm happy to
| see more people noticing it.
| brabel wrote:
| I tried learning Ada a few years ago and was really put off
| by GNAT. Installation was something straight out of the 80's
| and I just forgot about it after a little fussing around
| without getting anything working.
|
| Great to know that's no longer the experience with Ada, I
| might finally get it and try to start a project using it.
| riku_iki wrote:
| > Ada's been steadily making a reassurance I think since
| safer languages like Rust had started to gain traction
|
| Why one would use Ada now when it looks like there are much
| stronger contenders in this space: rust for close to metal
| and C#, Java, Go for slower programs?
| kitd wrote:
| Oof! You were going so well .
| fwip wrote:
| Ada has features built in that those languages do not have.
|
| Off the top of my head, Ada has "restricted types" (e.g:
| you can say a function takes an integer of the range 5-15
| only), as well as pre-and-post conditions you can annotate
| your procedure definition with.
| riku_iki wrote:
| It sounds like this can be implemented as some 3p libs,
| and not necessary be a part of language?
| kevlar700 wrote:
| Rust tries with a crate and traits but it misses out on
| e.g. record memory overlays which are so powerful in Ada.
| Type design is beautifully intuitive for the main part in
| Ada too. Restricting your parameters with ease means
| there is less logic to write and mistakes and refactor
| fallout gets caught early.
| ajdude wrote:
| I like in Ada's type system in that I can do constraints
| such as "type Positive is Integer range 1 ..
| Integer'Last;" to give me a number that I know must
| always be in the positive range of an integer, and it's
| easily readable in plain text.
|
| From what I have read, trying to do something like "type
| Element is Integer range 100 .. 1000;" in rust requires
| something along the lines of struct
| BoundedU16<const MIN: u16, const MAX: u16>(u16);
| impl<const MIN: u16, const MAX: u16> BoundedU16<MIN, MAX>
| { pub const fn new(value: u16) ->
| Result<Self, BoundError> { if value >=
| MIN && value <= MAX {
| Ok(Self(value)) } else {
| Err(BoundError(value, MIN, MAX)) }
| } }
| crabbone wrote:
| Now how about using this type as an array index? In Ada,
| when you declare an array with this kind of type as an
| index, it automatically knows its size, generates a bunch
| of methods to help with iteration and element access, and
| these methods are "generic" in a sense that the
| programmer doesn't need to know the lowest or highest
| index of an array in order to iterate over it.
|
| On the other hand: these types make life hard. Kind of
| like Rust's lifetimes. Sometimes obviously correct code
| doesn't compile and you need to twist and tie yourself
| into knots in order to get a much more convoluted version
| to compile. Well, like Rust.
|
| They are indeed very similar, and require approximately
| the same level of pain tolerance.
| kevlar700 wrote:
| Honestly Ada is far better than Rust for close to metal as
| it was designed for it. It is also safer and easier to use
| than Rust. Ada has also been demonstrated to be more cost
| effective over a programs lifetime than C, C++ and Java. I
| also dropped Go for Ada and prefer the quality and memory
| control that Ada offers. The only thing I miss are the
| stdlib docs and the ease of cross compilation.
| lolinder wrote:
| > Ada is far better than Rust for close to metal as it
| was designed for it.
|
| Sorry, can you elaborate on this? Rust was _also_
| designed to be close to the metal, so I 'm assuming that
| there's some concrete difference that you're referring
| to.
|
| > Ada has also been demonstrated to be more cost
| effective over a programs lifetime than C, C++ and Java.
|
| Do you have a citation for this improved cost-
| effectiveness? Things like that are notoriously difficult
| to prove, so I'd be curious to know how this was
| measured.
| spauldo wrote:
| My guess? There have been a few high profile security CVEs
| lately and the "why are we still using C" crowd is louder than
| usual. Ada's a viable alternative for performant system code,
| and it's kind of the underdog to Rust.
| nicce wrote:
| Ada is not memory safe language tho, while it might make it a
| bit harder to introduce those bugs.
| ajdude wrote:
| Ada is memory safe if you just work with the stack or avoid
| Unchecked_Deallocation. Since functions can allocate and
| return entire arrays and other data structures completely
| on the stack, you don't need to mess with the heap that
| often (and when you do, you can also define your own memory
| pools).
|
| If you have to use dynamic allocation, you could also use
| the built in container libraries or controlled types for
| additional safety.
|
| Though if you want the kind of memory safety that Rust has,
| there's always SPARK (a subset of Ada).
| bluGill wrote:
| Is there a free version of SPARK? Proven correct code
| appeals to me, but I don't enjoy trying to get anything
| past purchasing.
| ajdude wrote:
| SPARK is free by default, and readily available. You can
| use it as-is in ada by adding " with SPARK_Mode => On" to
| your code; here's some examples:
| https://learn.adacore.com/courses/intro-to-
| spark/chapters/01...
|
| You can install gnatprove with alire via "alr install
| gnatprove"
| mcguire wrote:
| It's been a while since I looked at SPARK and Ada, but
| the last time I did, SPARK was very well integrated with
| the GNAT Studio IDE.
|
| I still preferred frama-c, because C, but it's a really
| nice toolchain.
| kevlar700 wrote:
| Ada goes beyond memory safety.
| Barrin92 wrote:
| I saw a fairly popular programming Twitch streamer / Youtuber
| put out a bunch of Ada content recently, don't know if it's
| cause or effect but content creators seem to have a bit of
| influence these days. Was definitely the case with the recent
| htmx wave.
| fer wrote:
| On a related note, here's a throwback for old-timers:
| https://adagide.martincarlisle.com/
| agsacct wrote:
| one of my old professors. Blast from the past!
| inamberclad wrote:
| I'm a little confused - is this just a wrapper around
| https://alire.ada.dev/ ? That tool itself isn't very hard to
| install.
| ajdude wrote:
| Getting alire installed involves downloading the zip,
| extracting the binary, and moving the binary to a directory in
| $PATH. If you're on a mac, you also have to run an "xattr"
| command on the tool to get it running.
|
| I've seen the last parts get newcomers tripped up so Getada
| takes the rustup approach.
|
| It uses github's api to retrieve the latest published release
| of alire[1] and then downloads and extracts it to a specified
| directory in $HOME. Then it creates an env file[2] and sources
| that file in .profile and/or .zshenv. It also logs everything
| that it does so it can undo it later with getada --uninstall
|
| [1] https://github.com/alire-project/alire/releases
|
| [2] Here's roughly what the env file looks like that it creates
| https://github.com/AJ-Ianozi/getada/blob/main/src/shells.adb...
| Karellen wrote:
| > Getting alire installed involves downloading the zip,
| extracting the binary, and moving the binary to a directory
| in $PATH. If you're on a mac, you also have to run an "xattr"
| command on the tool to get it running.
|
| Is that considered a high bar for software developers to get
| right?
| adastra22 wrote:
| In practice, yes.
| vips7L wrote:
| Shouldn't a good package manager just take care of those
| steps?
| crabbone wrote:
| Alire is kind of a bummer on musl systems...
|
| I don't know if this tool solves the problem, but on musl
| systems (eg. Apline) you have to build Alire from source...
| i.e. bootstrapping, dependencies... it's not pretty.
| ajdude wrote:
| > I don't know if this tool solves the problem
|
| Not yet but it's on my list as a "phase 2" of sorts for
| getada. I have an alpine VPS that I'm playing around with but
| the main issue is that while alire can be built for alpine,
| any compilers it pulls from its toolchain won't work with it
| since none of them are built against musl. We've been talking
| about it here https://github.com/alire-
| project/alire/issues/792#issuecomme...
| trollian wrote:
| How is this not called "Byron"?
| nmz wrote:
| Stop being smart. The tool is called GetAda, what does it do?
| It gets ada. What would byron do? will you remember 3 years
| from now?
| jclulow wrote:
| Well then surely it should be "UpdAda"?
|
| (I hardly...)
| timeon wrote:
| How about "AddUp"?
| fiddlerwoaroof wrote:
| What happens when the community decides this one isn't good
| enough and comes up with a replacement? The problem I've
| always had with these descriptive names is (a) they are often
| hard to google because they conflict with all sorts of
| documentation about the problem space and (b) when they're
| deprecated, they become a trap for beginners. "Cute" project
| names are better for the same reason as we don't name
| children and pets random English phrases describing them.
| jrockway wrote:
| The replacement can just be called getada2. It worked for
| Python's standard library (unittest2 and all that).
| nmz wrote:
| Or fetchAda or grabAda, english is filled with synonyms.
| pixelatedindex wrote:
| Is this supposed to be a reference to something? I'm not
| following this logic :(
| sebtron wrote:
| Byron (the poet) was Ada Lovelace's father
| xyproto wrote:
| Does this make it possible to use Ada and SDL2 on Linux?
| synack wrote:
| SDLAda has been around for a while:
| https://github.com/Lucretia/sdlada
|
| You can add it as a dependency to your Alire project: `alr with
| sdlada`
| nmz wrote:
| Why can't you use sdl on ada? You can use raylib fine enough.
|
| https://www.youtube.com/watch?v=MUISz2qA640
| xyproto wrote:
| I've had issues with the combination of Ada + SDL2 + Linux in
| connection with https://github.com/xyproto/sdl2-examples.
|
| Raylib is cool, though.
| Lucretia9 wrote:
| Look at the "Linking" section https://github.com/ada-game-
| framework/sdlada
|
| I'm looking into getting it all automated through pragma's
| and gpr's.
| ultra_nick wrote:
| Bringing Ada into the 21st century bit by bit.
| sitzkrieg wrote:
| Other ecosystems are still catching up in some ways
| owlstuffing wrote:
| Yep, happy to see it, well deserved. Def a sleeper with tons of
| potential.
|
| Comprehensive IntelliJ-level IDE tooling could bring Ada to the
| forefront where it belongs. Would be nice anyway.
| adezxc wrote:
| > Since one of the biggest complaints about Ada is getting the
| toolchain [6], I hope this can solve a lot of problems for
| newcomers to the language.
|
| It might be just me, but Alire isn't great, I tried it multiple
| times, it's great for getting complicated dependencies e.g
| Utilada, but I go for GPRBuild as it just avoids all the fuss
| when programming across Linux/macOS.
|
| I might try a hard switch at one point as I didn't use Alire
| 2.0.0 that much, so maybe it's better now.
| Lucretia9 wrote:
| Alire is a frontend to the toolchain, including gprbuild, it
| just handles grabbing the projects as well.
| adezxc wrote:
| Yes, but it kinda locks you into running 'alr build' and adds
| other things inside 'config' directory like user's distro and
| other things. My guess it's probably great when you already
| have a done project and want to publish it, but if you want
| to compile your code ASAP, it's much easier to avoid it
| completely (except for pulling packages)
| ajdude wrote:
| Alire puts "/obj/", "/bin/", "/alire/", and "/config/" into
| its .gitignore when creating a new project so the platform-
| specific stuff shouldn't end up on other developer's
| machines. After your initial "alr init --bin myproj" you
| can dive into your "myproj.gpr" and do more than what alire
| supports in its toml file.
| kevlar700 wrote:
| literally
|
| alr init --bin new_project
|
| cd new_project
|
| alr edit
| Avshalom wrote:
| which is fine if you're using git. Just like asking me
| for my github login would be fine, if I used github and
| expected to ever distribute sdl_helloworld.
| crabbone wrote:
| Turns out putting "config" in .gitignore isn't a very
| good idea. Or, at least, there's a problem with what
| setting go into "config". In particular, compiler
| options, end up ignored... I had to undo it in the
| project I'm working on because I got tired of having to
| restore these options every time I change something else
| in dependencies / other project configuration.
| adezxc wrote:
| We use SVN in our university lab, so no, that didn't work
| when I tried it initially. obj and bin was obvious to
| ignore, but I wasn't so sure about config and alire,
| might be helpful though
| crabbone wrote:
| What's the need to compiler code _ASAP_? I understand it
| that you mean the initial effort, as running whatever
| command you normally use to build will have just the same
| amount of effort regardless of its length... But, even if
| for some reason you are typing it out every time: the
| difference will amount to just a few characters...
|
| I mean, how long of a delay are we talking about?
|
| ----
|
| As an aside, for me, a newcomer, GPRBuild is hard to deal
| with. I've dealt with at least a dozen of build systems,
| and GPRBuild isn't something I'm excited about. It belongs
| in the same category as Maven / Gradle / MSBuild / Bazel
| etc.: very bad at debugging, very limited documentation,
| impossible to tell what things are possible...
|
| The way for me to deal with GPRBuild is to create a project
| file using Alire, and when something breaks -- use Web
| search to find what needs to be changed. GNAT's errors are
| in general very, very bad, but when it comes to GPRBuild,
| it's almost like MS: the only use for the error message is
| that it's hopefully unique enough that there's a KB article
| somewhere that references it by id.
| Avshalom wrote:
| I believe you'll find its actually _utilada_
|
| alire doesn't let you use capital letters...
| ithkuil wrote:
| This! Tooling ease of use matters!
|
| A lot of interesting tech died off or never took off because the
| tooling was just too cumbersome to setup and use.
| dijit wrote:
| Honestly I think a lot of the Rust zealotry is because the
| tools are amazing.
|
| If it was just rustc on it's own I doubt it would have people
| chest-thumping like they do.
|
| I say this, as a lover of Rust: _precisely_ because of Cargo,
| rustup and the crate system.
| hu3 wrote:
| Eve more so in Go where the single standalone executable can:
|
| - run code
|
| - build code
|
| - format code
|
| - generate code
|
| - profile code including flame graphs
|
| - run tests and report performance down to allocations
|
| - benchmark code
|
| - manage packages
|
| - manage workspaces
|
| - scan and vet suspicious code
|
| It's amazing how much a 2 character command can do.
| jrockway wrote:
| gofmt is actually a separate command.
| hu3 wrote:
| Indeed!
|
| And it can be called from go command too: go fmt main.go
|
| https://pkg.go.dev/cmd/go#hdr-
| Gofmt__reformat__package_sourc...
| hyperman1 wrote:
| Since I started programming, I see every generation of
| programming languages slowly raise the bar. From the top of
| my head, in the order I encountered them.
|
| * C: make gave a standard way to compile/link a program. *
| Perl: CPAN as standard library/repository location. * Java:
| javadoc gave a standard format for low level documentation.
| Rules like 1 file=1 class, 1 folder=1 package gave a
| standard source tree layout. * Java/maven gave standard way
| to download, install and upgrade dependencys * Go: Built in
| formatter. * rust: cargo combines the strengths of Go
| standardization and Java/maven repositorys
|
| Every iteration provides extras that the previous tooling
| generation sees as trivial. They'll say you can add them to
| the mix yourself if you want to. Their company likes things
| in a different way, and are happy to have the option.
|
| But that's missing the point. The whole language ecosystems
| standardizes on a reasonable (but not 100% perfect) way of
| working. This has a lot of secondary benefits: * People
| move easily between organisations with minimal up-to-speed
| costs. * Somewhere in the ecosystem, someone still has your
| ancient tooling version, and the upgrade path is clear(er).
| * No discussion about in-house standards. (Try to get 2 C
| programmers agree on a coding style and watch the hours fly
| discussing what to take from ugly K&R vs ugly GNU.) * Real
| pain-points get solved, because someone feels your pain.
|
| I've seen the in-house stack developed by a Cobol company.
| It's finely tuned to that 1 company, yielding huge
| benefits. It's also a very non-trivial investment and
| maintenance cost.
| andrewflnr wrote:
| I would be slightly more cynical and suggest that the easy
| tooling enables people prone to cheap chest-thumping to get
| into the language, when otherwise those types would probably
| wander somewhere else. The difficulty of the borrow checker
| will already create investment-induced loyalty[0], but if the
| first difficulty isn't even unique to the project, then the
| interesting difficulty doesn't have a chance to work.
|
| Speaking, myself, as someone who likes Rust but wishes people
| would be more clear-eyed and less obnoxious about it.
|
| [0] Someone remind me what the standard term for this is? You
| know, the thing where people get really emotionally invested
| in things where they've invested a lot of time and effort,
| like Vi or Emacs or Dark Souls?
| flakes wrote:
| > investment-induced loyalty
|
| Would generally refer to this as a sunk cost dilemma
| andrewflnr wrote:
| I thought about trying to use "sunk cost", but I usually
| see it written as "sunk cost fallacy" and that's a
| (closely related, but) slightly different thing.
| sammoe13 wrote:
| I often use the phrase "[I/he/she/they/we] have already
| sunk so much time into ..." Not dissimilar to "sunk cost".
| bluGill wrote:
| I'm a hater of rust because of cargo and cargo - while it
| makes getting started easier, it is one of several opinions
| rust forces on me that are not compatible with my current
| code and so it make it more difficult to figure out how to
| incrementally start using rust in my code base. For small
| greenfields projects it is nice, but I'm not in that world
| and rust is fighting me.
| ithkuil wrote:
| I agree. Same with Go. When I started with Go, I quickly
| forgave it all little rough edges in the language itself
| because they were offset by a tooling that was just miles
| ahead the state if the art of the time.
| kevlar700 wrote:
| They have improved go modules since but if you didn't use
| github gos tooling wasn't so great. I actually dropped Go
| for Ada and prefer Adas packaging.
| zamalek wrote:
| I chest thump because _more errors happen at compile time,_
| and fewer at runtime. The tooling is what I would consider
| basic competency these days. Go has a similar tooling story
| and, while I do enjoy the language, it doesn 't inspire chest
| thumping.
| randomdata wrote:
| _> I chest thump because more errors happen at compile
| time, and fewer at runtime._
|
| Why Rust, then? It is not particularly good on this front.
| Hardly the worst, but is still pretty Mickey Mouse compared
| to the languages that excel here.
|
| I expect the zealotry/chest thumping is entirely a product
| of fashion. There are some things about Rust that are truly
| great, but nobody would go out of their way to mention it
| if it wasn't what is in style.
| zamalek wrote:
| People get pretty riled up about the likes of Haskell,
| Elm, and OCaml. Rust brings some of the virtues of
| functional into procedural code/average developer hands,
| and out of "monads are just a monoid in the category of
| endofunctors."
|
| At the end of day, people are afraid of functional
| languages. It doesn't matter how amazing they are if
| almost everyone is too scared to use them.
| randomdata wrote:
| _> Rust brings some of the virtues of functional into
| procedural code /average developer hands_
|
| But so does, say, ATS and does a better job on the
| aforementioned merits. But, indeed, it is not in fashion.
|
| _> At the end of day, people are afraid of functional
| languages._
|
| To be fair, they are also afraid of Rust.
| IshKebab wrote:
| Part of it is, but the language is also great. It isn't
| Zealotry. Rust really is that great. Not flawless (async is a
| big wart), but still fantastic.
|
| I would say that applies much more for Go, where the language
| is decidedly meh, but the tooling is fantastic. Arguably even
| better than Rust.
| didip wrote:
| This is amazing. devX matter a lot for adoption. I keep hearing
| about Ada a lot but the learning experience were difficult when I
| tried it.
| kevlar700 wrote:
| Did you come across? https://learn.adacore.com
| max-privatevoid wrote:
| Just use Nix
| throwaway81523 wrote:
| > One of my goals with Ada is to have a one-liner copy-paste
| terminal command for people to install Ada so they can get to
| coding in just a few minutes. After extensive testing I feel like
| it's ready for general release[1].
|
| I never had trouble with this? Apt-get install gnat or similar
| has always worked for me. I only played around with Ada though,
| never did anything serious with it. Installing from source wasn't
| too bad either. But, trying to install spark from source was a
| big mess back in the day. I don't know about now.
| tormeh wrote:
| What's cool about rustup is having many different versions of
| the same toolchain installed at the same time, and
| automatically using the appropriate toolchain version for a
| project. That's downright magical.
___________________________________________________________________
(page generated 2024-04-23 23:00 UTC)