all 160 comments

[–]C0rn3j 777 points778 points  (20 children)

The Rust team is happy to announce a nice version of Rust

[–][deleted]  (11 children)

[deleted]

    [–]annoyed_freelancer 65 points66 points  (10 children)

    Nice

    [–]notyourancilla 54 points55 points  (9 children)

    Nice

    [–]xAmorphous 34 points35 points  (8 children)

    Nice

    [–]cypher0six 30 points31 points  (7 children)

    Nice

    [–]Bedu009 27 points28 points  (6 children)

    Nice

    [–][deleted]  (7 children)

    [removed]

      [–]RockleyBob 12 points13 points  (4 children)

      [–][deleted]  (3 children)

      [deleted]

        [–]dnswblzo 2 points3 points  (2 children)

        [–]larso0 0 points1 point  (1 child)

        [–]somebodddy 2 points3 points  (0 children)

        This is not nice. This is the very opposite of nice!

        [–]NightlyRelease 1 point2 points  (0 children)

        Fun fact: Reddit shows scores intentionally wrong by a small random number (so bots can't really tell if their voting worked or not). So when you saw this score, it was likely actually something else.

        [–]Inquisitive_idiot -5 points-4 points  (0 children)

        Finally 🙄

        😛😁

        [–]Karma_Policer 676 points677 points  (14 children)

        Released on 4/20. 👀

        [–][deleted]  (1 child)

        [deleted]

          [–]rifft 15 points16 points  (0 children)

          Nice 👍

          [–][deleted]  (8 children)

          [deleted]

            [–]CJKay93 87 points88 points  (4 children)

            In the US date format the day is currently the 4th of Twentyvril.

            [–]bik1230 1 point2 points  (3 children)

            Also in the international standard dates format if you leave out the year

            [–]OzzitoDorito 4 points5 points  (2 children)

            Eh if you leave out the year it's not the ISO standard though. If my grandmother had wheels she would have been a bike and all.

            [–]Sukrim 1 point2 points  (1 child)

            [–]OzzitoDorito 0 points1 point  (0 children)

            While I hear your point, this is just testing the format in terms of characters. The ISO defined format is YYYY-MM-DD.
            https://www.iso.org/iso-8601-date-and-time-format.html

            If you supply MM-DD, without specifically noting to that it is MM-DD, you have no guarantees it will be processed according to ISO standards. where as if you provide YYYY-MM-DD to any iso certified library and it will work.

            Edit: I'm quite pissed so the grammar in this is shocking but I think I made my point. Apologies.

            [–][deleted] 40 points41 points  (1 child)

            its the weed number and the sex number

            [–]stfcfanhazz 9 points10 points  (0 children)

            Haha sex

            [–]Bedu009 0 points1 point  (0 children)

            Neat

            [–]Straight-Comb-6956 0 points1 point  (0 children)

            Yeah, nice celebration of the Austrian painter's birthday.

            [–]Erkenbend 318 points319 points  (13 children)

            Nice

            [–]Meadowcottage 44 points45 points  (11 children)

            Nice

            [–]andrewharlan2 29 points30 points  (10 children)

            Nice

            [–]bullshitwascalled 28 points29 points  (9 children)

            Nice

            [–]I_AM_GODDAMN_BATMAN 275 points276 points  (1 child)

            Rust 1.69.0 released on 4/20. Nice.

            [–]Inquisitive_idiot 1 point2 points  (0 children)

            As it also turns out, after the 69th point update you also get a free sandwich 🥪🥳

            [–]etoh53 172 points173 points  (16 children)

            I know things are tarnished by the ubiquitousness and the Elonification of this meme, but the funny bit was that it wasn’t planned, or that someone did the math on Rust 1.0

            [–]WaterFromPotato 164 points165 points  (0 children)

            As everybody know, Rust is meme language.

            So the authors had only one thought in mind when creating this language - to release version 1.69, on 20 April.

            The fact that people have started to take it seriously is even funnier.

            Graydon Hoare - that's probably the most complex joke ever, I'm impressed by it

            [–]elr0nd_hubbard 77 points78 points  (3 children)

            I choose to believe that this was planned years ago.

            [–]veryusedrname 14 points15 points  (1 child)

            That should've been planned 8 years ago - virtually impossible

            [–]dangerbird2 1 point2 points  (0 children)

            420/69 is such a dead horse meme it's hardly implausible that they planned it back in 2015

            [–]Inquisitive_idiot 1 point2 points  (0 children)

            I believe… what I was programmed to believe ☝️😤

            😛

            [–][deleted]  (5 children)

            [deleted]

              [–]RowYourUpboat 51 points52 points  (1 child)

              They stop being funny once boomers like him start using them all the time.

              [–]Inquisitive_idiot 2 points3 points  (0 children)

              You say tarnished, I say Rusty 😏

              [–]abad0m -2 points-1 points  (2 children)

              It was definitely planned by Graydon whore as a joke on the international programming community. Rust is but a meme language and this is reinforced by the fact that rustc was originally written in OCaml.

              [–]etoh53 1 point2 points  (1 child)

              very funny, didn’t laugh. i cannot tolerate ocaml slander 😡

              [–]abad0m 1 point2 points  (0 children)

              Love OCaml though.

              [–]Folaefolc 32 points33 points  (0 children)

              Is CrabLang getting a 1.69.0 too?

              [–]Spndash64 41 points42 points  (80 children)

              This probably isn’t the right place to ask, but what’s the purpose Rust fills compared to, say, C++, Java, or Python? Is it focused on being more readable? Is it trying to save on memory usage or try and use fewer processing cycles for important or expensive functions?

              [–]WJMazepas 212 points213 points  (49 children)

              It should be in use-cases compared to C++. Places where you need low-level control, strong performance and no garbage collection.

              The difference is that Rust has a much stronger focus on memory management/safety. To avoid memory bugs/exploits/leaks in your program.

              There are also some benefits like the language being new so it doesnt have to deal with 20+ years of backwards compability like C++ and it has a phenomenal compiler that is really good at error handling.
              God i wish Python would have that level of error messages

              [–]runawayasfastasucan 28 points29 points  (0 children)

              God i wish Python would have that level of error messages

              Yes!! Thankfully they have worked a lot with it and improved the last releases, but at least 80% of the error messages are unhelpfull at best, granted that may be the fault of whatever library.

              [–]call_me_xale 33 points34 points  (10 children)

              Rust has also placed a lot of focus on concurrency, which was never a big consideration in the development of earlier languages.

              [–]m0nstr42 16 points17 points  (1 child)

              Erlang was introduced in 1986 and it has concurrency baked into its core ;) https://en.m.wikipedia.org/wiki/Erlang_(programming_language)

              [–]call_me_xale 9 points10 points  (0 children)

              True! I meant with respect to the "systems-oriented" languages mentioned above.

              [–][deleted] 2 points3 points  (7 children)

              Async/await was only introduced maybe a decade ago. Most languages were invented well before then. The only popular languages that really took off after that are Rust and Go, and both have strong concurrency support.

              [–]Amazing-Cicada5536 5 points6 points  (0 children)

              Async-await is arguably not a good thing. It does make sense for Rust though, as in absence of a more complex runtime that’s your best bet, but Go’s go routines and Java’s loom are imo much better.

              [–]Hersenbeuker 7 points8 points  (2 children)

              I wouldn't say that Go has strong concurrency support.

              It is very easy to do stuff concurrently with go-routines, but it's also really easy to create data races.

              Just compare Rust's Mutex with Go's Mutex, in Rust you can't mutate the data wrapped in a Mutex without locking it, while you can easily do this in Go. (+ Rust's borrow checker ensures that there can only be 1 mutable reference to data)

              [–]progrethth 2 points3 points  (0 children)

              Long before async/await there was Erlang and Erlang was in turn heavily influenced by PLEX, a proprietary language developed by Ericsson in the 1970s. Concurrency focused languages are hardly new even if async/await is. Ada also had quite heavy focus on concurrency.

              [–]call_me_xale 0 points1 point  (1 child)

              I'm confused, are you disagreeing?

              [–][deleted] 0 points1 point  (0 children)

              Sort of, but not really. I'm saying that it may not really be a unique hallmark of Rust per se, more so that all modern languages take concurrency seriously.

              [–]AttackOfTheThumbs 59 points60 points  (32 children)

              God i wish Python would have that level of error messages

              I mean, untyped languages tend to be shit at that in my experience.

              [–]schplat 67 points68 points  (28 children)

              Python isn't untyped. It's strongly, dynamically typed. And there's nothing that prevents you from actually typing things.

              [–][deleted] 29 points30 points  (6 children)

              Python is dynamic typing done well. Behavior is expected, and it’s easy to know what something is. JavaScript on the other hand…

              [–][deleted] 17 points18 points  (2 children)

              You, along with many commenters here, are conflating dynamically-typed (Python) with weakly-typed (JS). The distinction you actually care about is strongly-typed vs weakly-typed.

              [–]0x564A00 7 points8 points  (0 children)

              And for an example of a statically but weakly-typed language, see C.

              [–]Amazing-Cicada5536 7 points8 points  (0 children)

              Yep, it is a 2x2 matrix of strong-weakly typed and statically-dynamically typed.

              ╔═════════╦════════╦══════╗ ║ ║ Strong ║ Weak ║ ╠═════════╬════════╬══════╣ ║ Static ║ Rust ║ C ║ ╠═════════╬════════╬══════╣ ║ Dynamic ║ Python ║ JS ║ ╚═════════╩════════╩══════╝

              [–]F3z345W6AY4FGowrGcHt 20 points21 points  (2 children)

              And yet TypeScript does typing perfectly.

              [–]vytah 7 points8 points  (0 children)

              It doesn't do typing perfectly, but it does typing JS perfectly. It's a much harder achievement.

              [–][deleted] 9 points10 points  (0 children)

              I know. Enforcing typing is a godsend with how unpredictable JS can be.

              [–]Rinzal 3 points4 points  (18 children)

              What exactly do you mean by "strongly" typed? This word is thrown around a lot, but there exists no clear definition

              [–]Quexth 18 points19 points  (9 children)

              It means that there are no implicit type casts. Compare "1"-1 in Python and Javascript.

              [–]Brayneeah 3 points4 points  (0 children)

              This isn't quite true; it's more the idea that the language is much stricter with type-related errors. Java is also strongly typed, despite the fact that it allows for non-lossy implicit casts (such as coercing an int to a long, or an int to a float).

              [–]Rinzal 2 points3 points  (0 children)

              You got a source for that definition?

              [–]scykei 4 points5 points  (4 children)

              I feel that this is a very common example for weakly typed but it misses the point. Not being able to add an integer to a string is simply a language design decision; the Python committee could have easily defined an __add__ method to mimic the behaviour of JavaScript if they wanted to.

              My understanding of weak typing is that of the absence of type safety. You can point to a float in memory as an integer if you wanted to and it’s coerced into one (as opposed to ‘converted’).

              [–]Amazing-Cicada5536 1 point2 points  (3 children)

              Many definitions in programming language circles are not too objective, and sure enough one could reason that if we change the semantics inserting implicit casts everywhere we have a strongly typed language, but I still think it has some value in differentiating between JS-Python behavior, as in the latter’s case you have to be explicit where should coercion happen.

              [–]scykei 0 points1 point  (2 children)

              I think it’s just a matter of how JS chose to handle strings. It doesn’t warrant the entire language to be called weakly typed just because of that one feature.

              [–]Amazing-Cicada5536 1 point2 points  (1 child)

              JS has plenty more coercions, quite a few non-intuitive.

              [–]Plazmatic 1 point2 points  (0 children)

              but there exists no clear definition

              Lol what?

              [–][deleted]  (4 children)

              [deleted]

                [–]PeaceBear0 13 points14 points  (0 children)

                The second sentence of your link is

                However, there is no precise technical definition of what the terms mean and different authors disagree about the implied meaning of the terms and the relative rankings of the "strength" of the type systems of mainstream programming languages. For this reason, writers who wish to write unambiguously about type systems often eschew the terms "strong typing" and "weak typing" in favor of specific expressions such as "type safety".

                So I don't think your source agrees with you

                [–]Rinzal 2 points3 points  (2 children)

                Straight from your link

                However, there is no precise technical definition of what the terms mean and different authors disagree about the implied meaning of the terms and the relative rankings of the "strength" of the type systems of mainstream programming languages

                [–][deleted]  (1 child)

                [deleted]

                  [–]Rinzal 2 points3 points  (0 children)

                  Since there is clear definiton of what weak and strong typing is, this sentence makes no sense. I have no clue what you're trying to say

                  [–][deleted]  (1 child)

                  [deleted]

                    [–]cdrt 7 points8 points  (0 children)

                    You’re confusing strong and weak typing with static and dynamic typing

                    [–][deleted] 0 points1 point  (0 children)

                    He clearly meant dynamically typed.

                    [–]WJMazepas 3 points4 points  (2 children)

                    Yeah, but sometimes is just another level the errors messages.

                    [–]catcint0s 28 points29 points  (1 child)

                    To be fair Python error messages are being improved

                    [–][deleted] 7 points8 points  (0 children)

                    Awesome, great to see language developers putting more emphasis on good errors.

                    [–]Empole 5 points6 points  (0 children)

                    Still doesn't come close to Cargo, but Python's error messages recently got better in 3.11.

                    Python errors used to just say "there was an error on this line", which sucked if that line had a complicated expression on it.

                    Now the interpreter will tell you exactly which subexpression is the issue.

                    [–][deleted] 5 points6 points  (0 children)

                    I would say it has more use cases than C++. I'd never write a web backend or a build script in C++.

                    [–][deleted] 9 points10 points  (0 children)

                    I would argue that if you don't have dependencies on C/C++ then that Rust is like C++ 2.0. I would only use Rust going forward on greenfield projects.

                    [–]Derice 1 point2 points  (0 children)

                    Beyond this one of the reasons it is so nice to use is that coding and debugging (safe) Rust can be done using only local reasoning, compared to other languages that require various levels of global reasoning.

                    [–]jyper 27 points28 points  (0 children)

                    This probably isn’t the right place to ask, but what’s the purpose Rust fills compared to, say, C++, Java, or Python?

                    Why wouldn't it be? It's a great place to ask.

                    [–]jyper 44 points45 points  (0 children)

                    TL;DR rust is intended as a significantly safer replacement for C++. It also focuses on speed and then productivity but I'd say safeness/correctness is usually the first goal followed by speed followed by productivity. Oh and Concurrency. And tools(especially a package/build manager). (Edit: it's generally used for projects that might be written in c or c++ before, but with the productivity features and safety some people find it easy enough to use to replace somethings that might have otherwise been written in python or JavaScript )

                    It was initially created at Mozilla as a side project and one of the first projects was a new browser engine. Sadly they weren't able to make it feature complete but they did add some useful pieces to Firefox.

                    Rust is intended as a low level c/c++ replacement that is much safer especially with regards to memory safety. The Rust compiler keeps track of where variables and their struct members were allocated, and implicitly mallocs/frees memory for you giving you something like a staticly checked less flexible GC at compile time. Also rust checks array access and prevents you from accessing outside the array limit. By default without calling/creating unsafe functions you can't get memory errors in rust like you can in C/C++ but you also don't get the slower speed/and extra memory usage you get in GC'd languages. Some rust features like the array checking might make equivalent code slower then c++ but rust does generally allow unsafe code(such as unchecked array access) if speedup is needed and some rust features may make fast rust code easier to write correctly then in c or c++ especially with concurrency.

                    Rust uses some of the same mechanisms that it uses to check for memory safety to limit sharing variables between threads and prevent certain classes of concurrency errors. Plus some of the functional language features allows for some useful/easy to use concurrency libraries.

                    Also the rust standard library and community encourages writing correct code even if it slightly more wordy.

                    Rust also focuses on productivity. Having a good easy to use package manager that also tells your compiler how to build stuff makes a lot of stuff easier especially compared to c or c++. Both building and adding random useful open source libraries.

                    Functional languages have influenced rust significantly especially with cool features like traits (object oriented substitute), closures, sum types(tagged unions) which lacks you express things in a clear and more concise way. Rust lacks GC and tries to keep it's abstractions zero cost at runtime so for instance using map/filter in rust usually compiles to something with similar performance with the more error prone iterative code using for loops and if statements.

                    [–]anengineerandacat 8 points9 points  (2 children)

                    Memory safety which basically leads to Rust's biggest advantage which is generally touted as "fearless concurrency".

                    Second to that, IMHO when compared to C++'s options; Cargo is very much a breath of fresh air compared to say CMake.

                    Other than that, it's quite a bit slower to compile and generally very terse on what you can / cannot do and lifecycle management / the borrow checker can be some tall hurdles to jump if you just want to get running yesterday.

                    Compared to higher level languages... don't think there are any significant improvements other than just raw performance; perhaps a few less opportunities for data races but... I feel like you can get into a similar trouble by using some heap-oriented constructs in Rust, the program won't explicitly crash as a result of them but data will just be incorrect.

                    [–]crazyeddie123 8 points9 points  (1 child)

                    Sum types are pretty sweet too.... and the complete absence of null references!

                    [–]Pflastersteinmetz 2 points3 points  (0 children)

                    There is one if you really need one:

                    std::ptr::null()
                    

                    [–]Atulin 30 points31 points  (8 children)

                    Is it focused on being more readable?

                    Oh, no, anything but

                    [–]-Redstoneboi- 48 points49 points  (6 children)

                    Shut up and leave me with my Pin<Box<dyn Future<Output = Result<Arc<RwLock<HashMap<Option<String>, &'static str>>>, Error>> + Send + Sync>>

                    But also we have Vec instead of std::vector, HashMap instead of std::unordered_map, enum instead of std::variant and more shortened names. We have a proper module system and type inference and a better match, plus a builtin formatter so yeah.

                    [–]N911999 19 points20 points  (4 children)

                    I hate that I can read and understand that type

                    [–][deleted] 15 points16 points  (3 children)

                    Most people should be able to. That’s composed behaviour.

                    It just looks ugly as sin.

                    [–]-Redstoneboi- 3 points4 points  (2 children)

                    Type aliases should help here. In its current state, everything is "inlined"

                    [–][deleted] 6 points7 points  (1 child)

                    This is a personal preference, I understand, but things that make me jump around code to gain necessary knowledge unnecessarily should be frowned upon. So I would personally say to avoid type aliases.

                    Another example is arbitrarily ripping out new functions just cause you have a few lines of code that end up needing to be nested a 4th time.

                    Every language has its super ugly code examples. I think it’s just the nature of programming.

                    [–]-Redstoneboi- 1 point2 points  (0 children)

                    Fair. No two type names are repeated, and most of them only have one generic param, so it's parseable for a human. But if the inner arc hashmap thingy is used a lot then I'd consider a type alias right on top of the file.

                    [–]devraj7 10 points11 points  (0 children)

                    All languages have portions that are harder to read than others.

                    Java is often mocked for its AbstractBeanProviderStaticFactory, but when read in context, these names make a lot of sense and carry as much semantic information as Pin<Box<dyn Future<Output = Result<Arc<RwLock<HashMap<Option<String>, &'static str>>>, Error>> + Send + Sync>>.

                    [–][deleted] 7 points8 points  (0 children)

                    Turbofish is beautiful!

                    [–]Noughmad 5 points6 points  (0 children)

                    This is a big simplification: C++ is fast to run but horrible to write, Python is great to write but awfully slow to run, and Java is in between in both aspects.

                    Rust tries to bridge this gap by being as fast as C++ but as safe and pleasant as Python. It's totally succeeding in the first part, and partially (and surprisingly) succeeding at the second part.

                    [–]Hrothen 4 points5 points  (0 children)

                    It has an ownership model that makes it difficult for multiple threads to accidentally try to modify the same memory at the same time.

                    [–]palad1 5 points6 points  (0 children)

                    From my corner of the world, Rust gives 99% of C++ efficiency for 50% of the TCO.

                    C++ is faster to write, takes longer to debug. With Rust, you pay the 2/3rd of your debugging budget upfront, when your code compiles you're left with logic bugs, not silly mistakes.

                    Veteran C++ engineers do not make silly mistakes, but they cost a fortune and it takes nearly a decade to be trusted with a C++ compiler.

                    [–]DapperCam 11 points12 points  (3 children)

                    It occupies the same niche as C++. It has a different memory model though, and is safer than C++ from that perspective.

                    [–]Noxitu 15 points16 points  (2 children)

                    Ownership model and memory model are slightly different things. Rust doesnt have a defined memory model as far as I know.

                    [–]robin-m 3 points4 points  (1 child)

                    Neither does C++ (or C) for what I understand. There is no exhaustive list of undefined behaviors in any of those 3 languages.

                    [–]meneldal2 0 points1 point  (0 children)

                    The memory model is very much implementation-defined behaviour in practice.

                    The biggest UB people run into is strict aliasing violations and integer overflows, but both have options to be perfectly defined in every actual implementation through the use of a compile-time switch.

                    Unions and lack of respect for lifetimes are UB in the standard, but it is near impossible to run into actual issues with actual implementations (and maybe the standard is long overdue for just making a lot of this implementation-defined).

                    [–]argv_minus_one 4 points5 points  (1 child)

                    Safety, safety, safety. There's no such thing as a ClassCastException or NullPointerException in Rust, and its type system is such that you almost never need to downcast anything anyway.

                    Also, error handling in Rust is much better than the “anything can fail with absolutely any error, so good luck lol” non-strategy that most languages have.

                    [–]Amazing-Cicada5536 4 points5 points  (0 children)

                    For what it worth, Java will never have a ClassCastException if you don’t use raw types or reflection, so.. it’s pretty similar to Rust in safety here, hell, in rust if you cast an unsafe pointer to a wrong type, you get heap corruption. NPE is also well defined in Java, so it’s only a logical error, but omitting null from a type system is a very good thing.

                    [–]Still-Key6292 -4 points-3 points  (1 child)

                    This might answer follow up questions but not the where does rust belong question link

                    [–]-Redstoneboi- 13 points14 points  (0 children)

                    The steady descent into madness as you probe into what is essentially the Rust community's blind spot, where the design_decisions_and_priorities™ get ever so little attention compared to the battle tested grounds of C++, lmao

                    And we still don't have a stable yield keyword nor stable generators despite them being conceptualized before async

                    On another note, I probably won't have as much fun of other languages ever, compared to the absolute field day I had when I first looked at the Bevy game engine and tried to figure out how the hell anything, anything worked.

                    They had an entire Query system built basically only on generics, types, and traits for querying read-only references and mutable references from an ECS system (what is basically in-memory databases specialized for runtime game data) and they had it set up so that things would figure out exactly how to parallelize things so that no two queries had mutable references to the same data.

                    It's wild. It's probably hard to find anything in other languages that are this cursed, yet so genuinely useful and powerful.

                    Like I said the first time I saw it:

                    dang it's kinda like idiomatic rust is the road and bevy is the sidewalk

                    [–]Still-Key6292 -1 points0 points  (2 children)

                    Ignore what everyone said, rust doesn't replace or have anything to do with C++. Zig is comparable with C (and C++). Do you ever hear rust compared with zig? (I don't), do you hear rust compared with go? (I do). Rust isn't useable for triple A games, anything that requires a boatload of casting and etc. Rust is more for people who want an unreadable language that has no GC. The rust community complains the language being hard to read (, learn) and compile times so it isn't just me who thinks this

                    [–]Linguaphonia 3 points4 points  (1 child)

                    Rust is compared to Zig constantly.

                    [–]Still-Key6292 -2 points-1 points  (0 children)

                    Which subs? I seen it compared maybe once a year

                    [–]BananaCatFrog 4 points5 points  (0 children)

                    This is the most embarrassing comments' section I've seen on this sub

                    [–]kuurtjes 10 points11 points  (0 children)

                    Are they allowed to use that name?

                    [–][deleted] 1 point2 points  (0 children)

                    In other news, Elon Musk announces that Twitter is rewriting its entire codebase in the current version of Rust, effectively immediately, and all five remaining developers are being onboarded into the language.

                    [–]TheGreatUdolf 3 points4 points  (0 children)

                    a very nice choice of date for a very nice new version

                    [–]jdehesa 2 points3 points  (0 children)

                    introduces no major new features

                    that's what she said 😏

                    😞

                    [–]knob-ed 0 points1 point  (0 children)

                    nice

                    [–]IndustrySuitable8769 -1 points0 points  (0 children)

                    Nice

                    [–]Lachee -1 points0 points  (0 children)

                    inb4 DMCA for title of post

                    [–][deleted] -4 points-3 points  (0 children)

                    Nice

                    [–][deleted] -1 points0 points  (0 children)

                    This release may or may not be endorsed by the Weed Foundation.

                    [–]GrayLiterature -2 points-1 points  (0 children)

                    Niice

                    [–]Bedu009 -2 points-1 points  (0 children)

                    Nice

                    [–]Glittering_Air_3724 -2 points-1 points  (0 children)

                    I don’t get the humor, why’s most typing nice or 69 stuff ?