Similarities To Other Languages

Are there portions of the Rust language that resemble other languages, at least in part? Like is the security portion like ADA? Does the typing follow stringent rules checked by the compiler? Does it use 'local' and/or 'global' variables? What is the 'magic sauce' that guarantees 'security' of finished applications?

Is the only reason why Rust is faster than other languages because of 'no runtime load for garbage collection'?

What language is the compiler for Rust written in?

I am truly interested in how you have created this new language. Thanks...
Robert

I'm only a rust noob but I'll take stab at this:

Looks a lot like C to me. I'm told it has some features that look like they came from Haskell, Ruby and so on.

I have used Ada a bit years ago, in a secure wireless communication system as it happens, I don't recall anything in Ada referred to as "the security portion". Please clarify what you mean.

Rust is statically and strongly typed. Like Ada.

Locals, yes. I'll let others comment on globals. Strongly discouraged.

Nothing will guarantee the "security" of your program if you mean "security" as is typically meant by a computer security researchers and penetration testers.

Rust does however guarantee memory safety and data race safety by not allowing multiple references to the same data that allow it's mutation and not allowing data to be read whist it is being mutated. These rules are checked and enforced at compile time and so incur no run time performance cost.

By the way, Ada is looking into adopting something of the Rust anti-aliasing features now.

I think one of the best explanations of that "magic souce" is in this presentation:
"Polonius: Either Borrower or Lender Be, but Responsibly - Niko Matsakis": https://www.youtube.com/watch?v=_agDeiWek8w&t=4s

For the best practical introduction to data lifetimes and the borrow checker see here:
"Crust of Rust: Lifetime Annotations": https://www.youtube.com/watch?v=rAl-9HwD858

Rust is fast because it compiles to native code, like C and C++ do. Like them it also has no garbage collector or run time to slow things down. Rust uses LLVM to generate and optimize code, as used by clang, so performance is comparable.

Why Rust of course. The front end anyway. The back end leverages LLVM.

2 Likes

The Rust Reference has an Influences appendix, which lists languages that had a significant influence on Rust's design.

Currently, rustc is written in Rust, but early versions were written in OCaml.

4 Likes

ZiCog
I personally have no first hand experience with ADA, but I remember having read an article where Boeing used it, almost exclusively, to develop its avionics control software for the 777. My reference was about, my belief, that ADA's process does not allow 'type casting' like C and also uses 'static compiling', (possibly avoiding dynamic library version hell). It might be more about better 'memory management' and/or less 'dangling pointers' than security, per se, that I believed generated stronger (hence possibly) less vulnerable machine code. Hence possibly less weak points for attack vectors, from a security sense. I understand that one bad vector is all it takes and less does not mean better or more secure, necessarily. It was just my takeaway overall.

Using "the security portion" were my words and I may have misrepresented my meaning, a bit, when I quoted them . It was just a take away that left me believing that the final product (by using ADA almost exclusively (99.9%) on the avionics software of the 777) was more robust by so doing.

Thanks for those references I will definitely have a look at all of them.

I must say that better speed and safer code (combined) really gets my attention. Thank you so much for your detailed reply...
Robert

Hi mbrubeck
Thank you for the 'Influences' reference. There is no more comforting approach than using ones own programming language to write ones compiler. That is one thing that always impressed me about the 'C' language. It sounds like their goal with 'rust' is much more about 'reliable outcomes' than 'flexibility for coders'. I like that focus and I definitely want to learn more about 'Rust'.
I have never heard about the OCaml language prior to this post. Cheers...
Robert

Coincidently I worked with the group that wrote the Boeing 777 Primary Flight Computer software. It was written by GEC-Avionics in England. They also designed and built the PFC computers. I was on the test team there rather than actually cutting Ada code. You are right it was written in Ada although you would be amazed at how much assembler there was buried in peripheral interfaces and such.

Ada certainly has a very strict type system including the ability to define integer types with restricted ranges of values and so on. It can check for overflow/underflow on everything.

Ada has continued to evolve since that time, I'm not up to date with it now, but I did read an interesting article about how the Ada creators were looking to add Rust like alias checking to their language. Sadly I can't find that article just now.

I found links to said stories about Ada adopting Rust borrow checker ideas. On this very forum:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.