More

    Rust Copies C, C++, Topples Legacy’s Crown


    C and C++ are among the most pervasive programming languages in the software industry today, with over 6.3 million developers using the language to code just about everything. Now, there is another language that has proven to be a worthy competitor to C and C++; Rust.

    Developed by a Mozilla Research employee Grayson Hoare, Rust has grown into its own over the past 15 years of its existence. From being picked up by tech giants like AWS, Meta, and Atlassian to supporting Web3 ecosystems like Ethereum and Solana, Rust is quickly becoming a superstar in the development world. 

    Moreover, the language has also been voted as the most-loved programming language in Stack Overflow’s Developer Survey for the past seven years. But what makes this language so loved and powerful and does it have the capability to replace C?

    Read: Should we call Rust a Failed Programming Language?

    The grandchild of C

    The language borrowed the best elements from multiple programming languages, such as the easy-to-use syntax of C and C++ along with the functional nature of languages like Haskell. This piecemeal approach resulted in Rust collating many of the developer’s beloved features while keeping a focus on fast execution and safe code.

    In the blog post announcing Rust’s 1.0 release, the team said, “[Rust’s] type system. . . represents a refinement and codification of best practices that have been hammered out by generations of C and C++ programmers”.


    Download our Mobile App


    In addition to its heritage from other languages, Rust has certain game-changing features of its own. For instance, Rust has granular access to low-level code while also toeing the line between capability and abstraction with its high-level capabilities. The language also boasts a robust optimiser and wields many zero-cost abstractions to cut down on runtime. 

    The language was built from the ground up to enable concurrent programming, a killer feature that makes it a must-have in the HPC field. Rust is also extremely focused on pushing developers to create memory-safe code, as it does not have in-built garbage collection. 

    The programme instead encourages memory borrowing and lending techniques, along with clear-set rules for when a variable will be dropped from memory. The focus on memory safety cuts down on the amount of bugs in the final product, saving on time and resources when it comes to deployment. 

    On the other hand, C and C++ suffer from feature creep brought on by years of haphazard updates. These old languages also lack the features that most developers take for granted in modern languages, like easy integrations for libraries, efficient memory management techniques and run-time checking. Reddit user Matthieum sums it up perfectly in a comment, stating,

    “C++ is a mess. It’s no one’s fault, really, mostly a historical accident, but it’s something you pay on a daily basis. There was not enough insanity in C so the developers of C++ decided to add some more. Did I talk about memory safety? Data-races? No. There’s little point really. To tame C++, one must gaze into the abyss.”

    Rust’s lack of garbage collection not only makes programmes run faster, it also makes it a viable drop-in replacement for C. Moreover, its nature as a language skirting the line between high-level and low-level makes it a good fit for applications that already use C and C++. 

    Will C be relegated to the past?

    Rust has many of the capabilities of C and C++, along with similar syntax. Further, due to the intrinsically safe nature of the language, even new developers can create complex code without worrying about application-breaking bugs. In addition to this, Rust also comes with ‘Cargo’, a build system and package manager, thereby making importing code easy. 

    Over the past few years, tech giants have also made it a point to integrate Rust into many of their offerings. AWS FireCracker VMM is built completely on Rust, and many other services like S3, EC2, CloudFront, and Route 53 all use Rust for deployment. The language has also been introduced into the Linux Kernel while Azure has largely shifted to using Rust over C citing security concerns. 

    When looking at the capabilities of Rust, it is highly possible that this language might become a stand-in for C in the near future. The Rust community has also created resources to port C/C++ code to Rust, and another member has created Corrode, a translation layer between C and Rust. 

    However, as seen with legacy languages like Fortran and COBOL, the industry has a lot of inertia when moving away from old systems. At the last estimate, there are approximately 10 billion lines of C++ code in a production environment. This implies that there is an equally strong force against switching to any language that is not C++. 

    However, with enough momentum behind Rust, it might become the status quo programming language of the future, with C and C++ being delegated to their rightful legacy position. 



    Source link

    Latest articles

    Related articles

    Discover more from Blog | News | Travel

    Subscribe now to keep reading and get access to the full archive.

    Continue reading