comp.lang.ada
 help / color / mirror / Atom feed
From: Kevin Chadwick <kevc3no4@gmail.com>
Subject: Re: Adacore joins with Ferrous Systems to support Rust
Date: Fri, 18 Feb 2022 05:24:15 -0800 (PST)	[thread overview]
Message-ID: <7cbebf58-7151-4e00-92bf-c3f2d751a22dn@googlegroups.com> (raw)
In-Reply-To: <87d2e0c1-c851-43e2-a085-fad30e475e35n@googlegroups.com>

> If possible please tell what Rust has to offer over Ada. 
> From a quick look at the Rust book it seemed weaker in structured programming, generic programming, type system. 
> Thanks.

I haven't written a single line of Rust and do not intend to but I have done some research 
before and after choosing Ada, to confirm my choice due to Rusts popularity. My biggest 
preference is Ada's readability, of course some love brevity even when it adds complexity 
for some reason that I cannot understand.

Adas type system has already been mentioned, but is fantastic.

Another is that Ada has a focus on Stack and has tried to offer more heap tools in recent decades. 
Rust has a focus on heap. I prefer the simpler stack default! Personally I avoided the heap, even with
C.

I have heard that Rusts ownership model can cause problem with local/stack usage of owned 
memory (podcast interviewing a core maintainer "Rust with Steve Klabnik" but from 2015).

I have seen Rusts unsafe used even for simple things in embedded Rust whilst removing ALL
of their 3 protections. Whereas with Ada you can more precisely permit pointer use and rarely 
need to. 

"https://docs.rs/svd2rust/0.19.0/svd2rust/#peripheral-api"

struct PA0 { _0: () }
impl PA0 {
    fn is_high(&self) -> bool {
        // NOTE(unsafe) actually safe because this is an atomic read with no side effects
        unsafe { (*GPIOA::ptr()).idr.read().bits() & 1 != 0 }
    }

    fn is_low(&self) -> bool {
        !self.is_high()
    }
}

Ada has been engineered to avoid pointer use, which I find appealing. Rust users would cite 
memory flexibility as appealing.

"Why Pascal is Not My Favorite Programming Language" by Kernighan is sometimes brought up, 
though much of it does not apply to Ada and no longer applies in any case and is clearly biased.
Does he really promote the use of #include! 
Personally I blame flexibility points of view like his as the primary cause, as to why I have critical
updates on my phone every single month and spend many days per year vulnerable to known 
exploits. Though really it is management at Vendors relentlessly pushing C. Maybe Rust can shift 
that closed point of view? I am aware that if my business does not succeed then the opportunity
to write Ada, may go with it.

WRT compile time checks vs runtime. 
GO was written precisely because it's authors were fed up waiting for C++ to compile. For me 
it is not important but worth bearing in mind.
Personally I like the simplicity of runtime checks. I have much more faith in them than compile 
time checks!
Though I confess to not knowing the details well enough to make that statement with complete 
confidence. It would also be nice to handle them more easily in a ZFP runtime.

SPARK sounds great and I like how it is intended to be applied where needed but I am dubious 
of any text that says it proves this or that, when it often depends on the tests implemented. 
I much prefer the language used by one AdaCore member in a podcast (Paul Butcher) along 
the lines of providing a high degree of confidence/assurance.

  parent reply	other threads:[~2022-02-18 13:24 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-02  8:57 Adacore joins with Ferrous Systems to support Rust Paul Rubin
2022-02-02 13:04 ` Luke A. Guest
2022-02-02 15:29   ` Marius Amado-Alves
2022-02-02 16:36     ` Luke A. Guest
2022-02-04 17:51       ` Stephen Leake
2022-04-18 16:01       ` Rene
2022-02-02 20:07     ` G.B.
2022-02-03 23:29     ` John McCabe
2022-02-11 17:40     ` amo...@unizar.es
2022-02-11 19:24       ` Luke A. Guest
2022-02-12 17:34         ` Alejandro R. Mosteo
2022-02-12  5:22       ` John Perry
2022-02-12 10:08         ` Marius Amado-Alves
2022-02-12 18:24         ` Alejandro R. Mosteo
2022-02-13  8:10           ` J-P. Rosen
2022-02-14 23:25           ` Randy Brukardt
2022-02-15  4:29             ` Paul Rubin
2022-02-12 23:59         ` John Perry
2022-02-18 13:24     ` Kevin Chadwick [this message]
2022-02-02 20:06   ` Paul Rubin
2022-02-03  1:34     ` Luke A. Guest
2022-02-03  2:20       ` Paul Rubin
2022-02-03  2:52         ` Luke A. Guest
2022-02-03  4:22           ` Paul Rubin
2022-02-03  9:54             ` Björn Lundin
2022-02-04  3:38             ` Randy Brukardt
2022-02-04  5:19               ` Paul Rubin
2022-02-03 11:30           ` Simon Wright
2022-02-03 12:51             ` Luke A. Guest
2022-02-04  3:20               ` Randy Brukardt
2022-02-04 10:28                 ` Luke A. Guest
2022-02-04 17:51                   ` Andreas ZEURCHER
2022-02-05  4:31                   ` Randy Brukardt
2022-02-02 16:19 ` Stephen Leake
2022-02-02 18:48 ` Gautier write-only address
2022-02-02 20:03   ` Paul Rubin
2022-02-02 20:45     ` Dennis Lee Bieber
2022-02-12  4:42 ` 25.BZ943
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox