Announcement

Collapse
No announcement yet.

Even Apple Is Interested In Migrating Their C Code To Rust

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael_S
    replied
    Originally posted by kpedersen
    Haha, yep, C certainly has its flaws (like all programming languages) but those who are paid to develop in it generally don't make these kinds of mistakes. If they did, most languages would be unusable because their VMs (CLR, JVM) are obviously written in C.
    C and C++ developers writing code for the Linux kernel, Windows, Mac, Chromium, OpenSSL, the Java Virtual Machine, and everything else routinely make those kinds of mistakes: data races, use-after-free, buffer overruns. So unless you're excluding most of the professional C and C++ developers in the entire industry, I don't know where you're getting your "those who are paid to develop in it" from.

    Originally posted by Kemosabe
    Yes, that's one of the famous Rust slogans thanks to the aggressive marketing. What it guarantees is no data races. Nothing more. Surely a useful thing but I would not call that "revolutionary". Not sure how interpreted languages guarantee things? Most of them are not even type safe... Nm.
    Rust guarantees no data races, no use-after-free, and no memory leaks, which is ahead of almost every other language without runtime garbage collection. The only competitor in that space I'm aware of is ATS, and that's pretty obscure. (Though the impressive thing is that ATS is a compile-time-only layer over C, so at runtime you literally get C performance exactly with all of the same safety guarantees as Rust. But the language has existed for a long time and never took off because it's so hard to learn.)

    Originally posted by onlyLinuxLuvUBack
    They could always use java, it would be a heavenly marriage of two greedy corps apple and oracle. Why don't they use java ? Oh because they can't control it and are afraid to get lawyer beatings from oracle.
    OpenJDK is GPLv2 with Class Path Exception ( https://openjdk.java.net/legal/gplv2+ce.html ), as long as you use that you're not getting lawyer attacks. Tons of companies use Java without paying Oracle anything. The 'lawyer beatings' are when you implement your own version of Java and use the Java name without entering a legal agreement with Oracle first. Even Amazon has their own version of OpenJDK, Corretto, and they don't pay Oracle for it - because it's under the GPLv2 license.

    Java performance isn't bad, depending upon what you're trying to do. In some web benchmarks it beats C++ and in other benchmarks performance ranges from 1x-3x C++. But Java is far more memory hungry than C++ or Rust, so if you're building something where low memory utilization is a requirement or at least boosts profits, then you should consider more memory-efficient options first.

    Leave a comment:


  • Luke_Wolf
    replied
    Originally posted by kravemir View Post
    Rust is definitely great language to write system applications/daemons in. More or less, it's useful for everything that is written once, and then used always/regularly on many (thousands or more,...) computers. Also, it's interesting option for heavy-load web services, when stable low latency (without spikes) is desired.
    It's basically a good language for everything other than scripting and things involving graphs with cycles.

    Originally posted by kravemir View Post
    However, Rust is not suitable for market, when there's implemented client's specific business/view logic, as that market goes for lowest development costs, which produce well usable outputs. So, we can rule out Rust from that market.
    I'm not sure I understand what you're trying to get at. Once you get your head around the borrow checker, Rust isn't really any slower of a language as far as development time goes vs Java, and if you're talking about the cost of hiring a Rust developer... well... a C# Developer starts at ~$80k/year for doing web development and there's plenty of positions going up to like $110k, so... If it's something else you're going to have to clarify

    Originally posted by kravemir View Post
    Currently, that market is dominated by Java and C#, and also by other scripting languages,... Golang is currently the most used language, which beats Java and C# regarding HW resources usage, and still offers the easiest way to manage memory (GC - requires almost zero programmer's assistance, ie. just don't have any unused memory still reachable from any thread).
    You're placing way too high a value on garbage collection. The days of manually futzing around with memory are over even in C++, don't need a garbage collector for that. Rust's ownership model takes care of memory to the same degree a garbage collector would, minus the overhead, and that scripting languages suck isn't really a point in Go's favour.

    Originally posted by kravemir View Post
    If golang gets generics, and there won't be any comparable language (regarding HW use) until then,... Then I bet, that golang is the future for web/backend in market delivering client's specific solutions.

    Well,... the market for client's specific web solutions would split, based on architects tastes,... Java and C# allows to easily create lots of spaghetti coupling, which can't be seen, but brings projects down over-time. In golang, spaghetti coupling is much more visible, and goes for better long-term maintainability of project.

    Of course,... when client's business heavily grows (happens maybe for one company out of tens of thousands), then rewrite in Rust definitely makes sense, if stable low latency (response time) is desired.
    Eh... usually the complaint is that C# and Java applications are too decoupled, with overuse of dependency injection (in order to serve the purposes of testing), layers upon layers of interfaces, and general code explosion not the reverse. With the other major complaint usually being that people who don't actually understand OOP, writing code that's not actually OOP by misusing inheritance.

    Additionally Go's implementation of the Interface concept isn't all that wonderful, and has the same fundamental issue as Java's due to (like most problems with the language) being too simple, whereas C# and Rust neatly sidestep the problem of method name collision in interfaces by tracking what's being implemented.

    Originally posted by kravemir View Post
    Yet, there's still no viable alternative to java / C# for mobile applications,...
    Java really, but yes. Granted you can use Xamarin with C# and Qt with C++, as well as a few other things, but Java is really the language de jure for Android which is really the only platform that matters in mobile.

    Leave a comment:


  • kravemir
    replied
    Originally posted by Luke_Wolf View Post

    Gonna call a big X to doubt on that one. Go had some initial popularity due to being from Google and being partially designed by Ken Thompson, however interest in the language is almost dead at this point because it's basically garbage collected C with interfaces, which isn't something anybody actually really wants. Beyond that it really only has traction in the sense that Ruby and PHP have traction, where it's used for the niche of server side development for web applications and even then companies like Discord are abandoning Go for Rust https://blog.discordapp.com/why-disc...t-a190bbca2b1f

    Meanwhile Java has mobile development on lockdown and much of the enterprise market because of the legacy of Google and Sun Microsystems, and C# is actually everywhere from game development, to mobile, to enterprise development because it's one of the most pleasant languages to write code in. Enterprises aren't going to suddenly rewrite their code in Go and only Google or some as yet unseen competitor that knocks them out can decide what the language of mobile development is. And C# is more than web... so we can cross that off too.

    Now as to whether Rust is a competitor to those... I also disagree... Like Java and C# (as well as C++), Rust was designed as a general purpose programming language that is capable of handling big architecture design. Being able to write code in a sane manner that gets up to hundred of thousands or millions of lines of code is necessary to be a competitor to C# or Java. Rust has that, Go doesn't, and that's really the big draw of those two languages. Now Rust will not take over mobile and thus Rust cannot be a competitor in that field, but bearing in mind that companies like Microsoft https://msrc-blog.microsoft.com/2019...st-in-windows/ , Apple, and Google are toying with Rust in various faculties, and that Rust is an exceedingly popular language with developers do not be surprised if the Enterprise Market shifts in Rust's direction for new development. Being safe and easy to write large programs in, not "omg it has a garbage collector" was Java and C#'s original draw for that market, and that would be the vector Rust would ride too.
    Rust is definitely great language to write system applications/daemons in. More or less, it's useful for everything that is written once, and then used always/regularly on many (thousands or more,...) computers. Also, it's interesting option for heavy-load web services, when stable low latency (without spikes) is desired.

    However, Rust is not suitable for market, when there's implemented client's specific business/view logic, as that market goes for lowest development costs, which produce well usable outputs. So, we can rule out Rust from that market.

    Currently, that market is dominated by Java and C#, and also by other scripting languages,... Golang is currently the most used language, which beats Java and C# regarding HW resources usage, and still offers the easiest way to manage memory (GC - requires almost zero programmer's assistance, ie. just don't have any unused memory still reachable from any thread). If golang gets generics, and there won't be any comparable language (regarding HW use) until then,... Then I bet, that golang is the future for web/backend in market delivering client's specific solutions.

    Well,... the market for client's specific web solutions would split, based on architects tastes,... Java and C# allows to easily create lots of spaghetti coupling, which can't be seen, but brings projects down over-time. In golang, spaghetti coupling is much more visible, and goes for better long-term maintainability of project.

    Of course,... when client's business heavily grows (happens maybe for one company out of tens of thousands), then rewrite in Rust definitely makes sense, if stable low latency (response time) is desired.

    Yet, there's still no viable alternative to java / C# for mobile applications,...

    Leave a comment:


  • Luke_Wolf
    replied
    Originally posted by kravemir View Post

    Yep, Rust is awesome regarding performance. Probably the fastest language, which provides safe (no dangling pointer) memory access guarantee, plus extra, provides no data race guarantee. And, Rust has got also great syntax and semantics.

    Yet, Rust doesn't replace C#/Java, which have fully automatic memory management, which requires (almost) zero programmer's assistance. In that genre of languages, golang (when/if/after it gets generics) is the future.
    Gonna call a big X to doubt on that one. Go had some initial popularity due to being from Google and being partially designed by Ken Thompson, however interest in the language is almost dead at this point because it's basically garbage collected C with interfaces, which isn't something anybody actually really wants. Beyond that it really only has traction in the sense that Ruby and PHP have traction, where it's used for the niche of server side development for web applications and even then companies like Discord are abandoning Go for Rust https://blog.discordapp.com/why-disc...t-a190bbca2b1f

    Meanwhile Java has mobile development on lockdown and much of the enterprise market because of the legacy of Google and Sun Microsystems, and C# is actually everywhere from game development, to mobile, to enterprise development because it's one of the most pleasant languages to write code in. Enterprises aren't going to suddenly rewrite their code in Go and only Google or some as yet unseen competitor that knocks them out can decide what the language of mobile development is. And C# is more than web... so we can cross that off too.

    Now as to whether Rust is a competitor to those... I also disagree... Like Java and C# (as well as C++), Rust was designed as a general purpose programming language that is capable of handling big architecture design. Being able to write code in a sane manner that gets up to hundred of thousands or millions of lines of code is necessary to be a competitor to C# or Java. Rust has that, Go doesn't, and that's really the big draw of those two languages. Now Rust will not take over mobile and thus Rust cannot be a competitor in that field, but bearing in mind that companies like Microsoft https://msrc-blog.microsoft.com/2019...st-in-windows/ , Apple, and Google are toying with Rust in various faculties, and that Rust is an exceedingly popular language with developers do not be surprised if the Enterprise Market shifts in Rust's direction for new development. Being safe and easy to write large programs in, not "omg it has a garbage collector" was Java and C#'s original draw for that market, and that would be the vector Rust would ride too.

    Leave a comment:


  • kravemir
    replied
    Originally posted by skierpage View Post
    Read A C# programmer examines Rust - Part 1 , the author raves about Rust.
    Yep, Rust is awesome regarding performance. Probably the fastest language, which provides safe (no dangling pointer) memory access guarantee, plus extra, provides no data race guarantee. And, Rust has got also great syntax and semantics.

    Yet, Rust doesn't replace C#/Java, which have fully automatic memory management, which requires (almost) zero programmer's assistance. In that genre of languages, golang (when/if/after it gets generics) is the future.

    Leave a comment:


  • ssokolow
    replied
    Originally posted by Brane215 View Post

    Then it wouldn't be Rust, but C dialect. There is C2Rust translation utility that works pretty well in many cases and can be used as a first, automated step in translation.

    One of the features of Rust is no friggin header files and declarations that one would have to repeat and check.

    My understanding is that C2Rust is for converting C codebases into Rust, not for linking against libraries that will remain in C. That's why I pointed to bindgen.

    Leave a comment:


  • Brane215
    replied
    Originally posted by kpedersen View Post

    This is a critical "flaw" in all other languages. Not being C makes a language annoying for systems development because we need to either write our own bindings, or drag in a dependency on someone elses bindings (often out of date and unmaintained).

    C++ and Objective-C are the closest because they are C (mostly); and they extend it. Then I just need to write thin safety (RAII) wrappers.

    If Rust could directly consume C headers and link against C libraries; it would be a game changer.
    Then it wouldn't be Rust, but C dialect. There is C2Rust translation utility that works pretty well in many cases and can be used as a first, automated step in translation.

    One of the features of Rust is no friggin header files and declarations that one would have to repeat and check.


    Leave a comment:


  • skierpage
    replied
    Read A C# programmer examines Rust - Part 1 , the author raves about Rust.

    Leave a comment:


  • onlyLinuxLuvUBack
    replied
    They could always use java, it would be a heavenly marriage of two greedy corps apple and oracle. Why don't they use java ? Oh because they can't control it and are afraid to get lawyer beatings from oracle.

    Leave a comment:


  • ksec
    replied
    Originally posted by Vistaus View Post
    And here I thought Apple was putting all their money on Swift, which they created...
    I always felt Swift was wrong or skeptical of it from the moment Chris Lattner said the language was suppose / aim to take on anything from C all the way to Javascript.
    Not only is it a tall order, I also thought it was unrealistic.

    Apple Pay is hiring as well for their work on many new function, and strictly Objective-C.

    Something about Swift smells / felt very similar to Dylan, which was created after Steve Jobs left in an effort to create the next generation Prefect Programming language. All while NeXT picked up objective C.

    5 years after its introduction Swift still felt very much unfinished.

    Leave a comment:

Working...
X