Learn Rust. NOW.

Home Forums Science & tech Learn Rust. NOW.

Viewing 41 reply threads
  • Author
    Posts
    • #154331
      Anonymous
      Guest

      Learn Rust. NOW.

      Rust is a fast, concurrent, compiled language in the spirit of C and C++. Rust offers many unique features and its core ideas, like ownership and mutability, are some of the best ideas that I’ve ever seen in my life.

    • #154332
      Anonymous
      Guest

      no tail call optimization, no good
      I’ll stick with F#

      • #154339
        Anonymous
        Guest

        >using the microshaft version instead of real ocaml
        cyanide. now

        • #154343
          Anonymous
          Guest

          >using a single core because your garbage collector is bad
          seethe

          • #154345
            Anonymous
            Guest

            >what is fork
            >what is mmap

      • #154347
        Anonymous
        Guest

        >no tail call optimization, no good
        cargo build –release
        You’ll get your TCO.

      • #154375
        Anonymous
        Guest

        >im too stupid to make a loop

      • #154437
        Anonymous
        Guest

        >no tail call optimization,
        So what does this cluster fuck do for recursive functions that are tail recursive, genuine question.

        • #154444
          Anonymous
          Guest

          rust is imperative, get over it
          do your CPS stuff in a proper FP language

    • #154333
      Anonymous
      Guest

      I don’t need something in the spirit of C. I already have C.
      >C++ is a bloated piece of shit with garbage educational material.
      >Rust tries to be a better C/C++ but manages worse performance and makes up for shitty programmers by bringing in its own GC and memory safety.

      • #154336
        Anonymous
        Guest

        >its own GC
        the last time rust had a gc you were still sucking your mom’s tits

        • #154383
          Anonymous
          Guest

          Already did.

          Insanely woke af

        • #154415
          Anonymous
          Guest

          still am

      • #154377
        Anonymous
        Guest

        > Rust
        > GC
        Its amazing. The people that hate Rust the most somehow know the least about it.

        • #154425
          Anonymous
          Guest

          your mentally ill delusions aren’t fooling anybody else. rust does have gc. and women don’t have penises.

        • #154445
          Anonymous
          Guest

          I think that statement is true generally

      • #154465
        Anonymous
        Guest

        But I don’t WANT more python nodeJS abstraction shit. I want just a regular programming languages like C or C++ lmao.

        I don’t want to keep going in reverse.

        This

        • #154466
          Anonymous
          Guest

          for the nth time RUST. DOES. NOT. HAVE. A GC
          that’s why it’s very easy to call C, C++ or fortran from rust

          • #154469
            Anonymous
            Guest

            But what is my main argument? its that I don’t want more abstractions. I want to move towards C not away from it.

            Operating systems are built in C. Every bit of microcode I’d imagine is too. Its the foundation and everything else is extra.

            You could make an argument that its all linkers and compilers and language constructs. Why then is it that we end up with C components in languages like Rust and Python then? Interoperability? Bullshit. C is faster/is the core man.

            The guy who built the LLVM that does the work for Rust works at Apple on Swift now. IMO he was what made Rust have anything tangible. Babbys first frameworks populating the crates package manager is no different than framework of the month syndrome in NPM/javascript.

            Im good man. I want to be able to write and build artifacts that are blackbox and are as low level as possible now.

            • #154473
              Anonymous
              Guest

              >C components in Rust
              the fuck are you talking about

            • #154486
              Anonymous
              Guest

              >But what is my main argument? its that I don’t want more abstractions. I want to move towards C not away from it.
              >Operating systems are built in C. Every bit of microcode I’d imagine is too. Its the foundation and everything else is extra.
              The need for "more abstractions" is caused by C being shit. That entire "foundation" is broken. As C became more popular, everything became worse. Slower, buggier, less powerful, and more bloated.

        • #154468
          Anonymous
          Guest

          sane & same

    • #154334
      Anonymous
      Guest

      I have. Rust and C++ are my favorite languages. Rust for an investment in the future, C++ for now. Fuck scrotes

    • #154335
      Anonymous
      Guest

      I will stick with the first programming language i decided to learn recently thank you.

    • #154337
      Anonymous
      Guest

      I’ve been told I’m not welcome in the rust communities. I don’t have any problem with the language itself, seems decent enough, but I’m not going to invest lots of time into a programming ecosystem where I can’t interact with the community.

      • #154340
        Anonymous
        Guest

        maybe next time don’t come in sperging about trans people

        • #154346
          Anonymous
          Guest

          I didn’t say anything about trans people. I called something scrotebrained, which supposedly is "ablerist" or some such bullshit. Anyways, I’ve seen such people before, pearl-clutching puritan burger-scrotebrains. You can be as snarky and mean spirited as you want as long as you do it passively-aggressively and along the lines of whatever arbitrary moral guidelines the community press-gang enforces at the moment. No thanks.

      • #154348
        Anonymous
        Guest

        real men learn to program by themselves

        • #154350
          Anonymous
          Guest

          I guess you’re a bit fresh to this and I like your attitude in general, but the problem isn’t learning a language, that takes a couple of weeks. The problem comes when sometime down the line you will have to interact with the community in some way, if only to report a bugfix or something.

          • #154352
            Anonymous
            Guest

            not new
            just open a pull request and be professional
            no need to mention the nwo plot to turn frogs gay and aggravate teenagers having mental problems because they didn’t have a father growing up

            • #154354
              Anonymous
              Guest

              No, I’ve already been told I’m not welcome in the rust community so how can there be any pull requests. No idea what’s going on with your strawman of gay frogs, but you do you.

              • #154359
                Anonymous
                Guest

                how exactly did that happen

                • #154361
                  Anonymous
                  Guest

                  Already explained that.

              • #154363
                Anonymous
                Guest

                Did they really permanently ban your github profile from contributing because of you calling a thing scrotebrained?

                • #154374
                  Anonymous
                  Guest

                  No of course not. I’m quite able to "sneak" myself back into the community. But I’m not going to do that when I’ve been told I’m not welcome. It’s the principle of the thing.

                  • #154402
                    Anonymous
                    Guest

                    I see. Fuck trannies I suppose

                    • #154404
                      Anonymous
                      Guest

                      Personally I don’t have anything against trannies, but I don’t accept being thought/speech policed in that way.

          • #154379
            Anonymous
            Guest

            >I guess you’re a bit fresh
            >The problem comes when sometime down the line you will have to interact with the community in some way, if only to report a bugfix or something.
            I’ve been programming in Rust for few years. I’ve contributed to open source projects, submitted issues, discussed Rust’s internals in their IRC, and nothing unpleasant happened. Not even /poo/tard trigger fuel like some random member having pronouns in their nick.

            What bad experiences did you exactly had with this community you are talking about?

      • #154483
        Anonymous
        Guest

        (((they))) want (((us))) to not use rust. That is the complete and utter truth. The superior straight man is being pushed awya from rust, which is proof that we should rebel and take over the trannies.

    • #154338
      Anonymous
      Guest

      Lol no concurrency

      • #154342
        Anonymous
        Guest

        You’re thinking of OCaml.

    • #154341
      Anonymous
      Guest

      >Learn Rust. NOW.
      Already did.

    • #154344
      Anonymous
      Guest

      Sorry, but I’m not trans.

      • #154349
        Anonymous
        Guest

        Neither am I, but I still program in Rust.

      • #154351
        Anonymous
        Guest

        Anon knows about the pipeline

    • #154353
      Anonymous
      Guest

      I can get 90% of the execution speed with 80% less development time and only 20% greater memory usage while automatically making myself 637% more employable.

      • #154355
        Anonymous
        Guest

        do you scrotebrains have pattern matching yet

        • #154373
          Anonymous
          Guest

          Just a if-else with syntactic sugar

          • #154408
            Anonymous
            Guest

            Not true by the way

            • #154410
              Anonymous
              Guest

              Prove it.

              • #154412
                Anonymous
                Guest

                will do if thread stays alive in a couple of hours but I’m busy rn

          • #154409
            Anonymous
            Guest
            • #154427
              Anonymous
              Guest

              in Go this is just
              if len(slice) == 0 {
              fmt.Println("empty")
              } else if len(slice) == 1 {
              fmt.Println("one")
              } else {
              fmt.Println(slice[0], slice[len(slice)-1])
              }

              if len(slice) > 0 {
              if slice[len(slice)-1] == "1" {
              fmt.Println("!!!")
              } else if slice[len(slice)-1] == "z" {
              fmt.Println(slice[:len(slice)-1])
              } else if slice[0] == "a" {
              fmt.Println(slice[1:])
              } else {
              fmt.Println(slice)
              }

              if len(slice) > 1 {
              fmt.Println(slice[len(slice)-2])
              }

              //no tuples

              • #154432
                Anonymous
                Guest

                if chains aren’t exhaustive

    • #154356
      Anonymous
      Guest

      C and C++ have much more developed ecosystems than Rust. C has been around for a very long time and has a lot of use in low-level stuffs, most notably the Linux kernel. Rust is Mozilla crap with a nasty community that acts as a solution to shitty programmers. I can’t see it gaining adoption for major projects already written in C or C++.

    • #154357
      Anonymous
      Guest

      >slow compilation times
      >low readability
      >high learning curve makes it hard to onboard others
      >bloated
      >machines, programming, and the real world are inherently unsafe. Rust inversed this principle so you are working with a delusional, backwards model of reality
      Only use Rust if you don’t value your time

      • #154360
        Anonymous
        Guest

        >write 50kloc of C++
        >you’re a genius so the thing almost never segfaults
        >overworked
        >boss hires junior pajeet to help you
        >pajeet’s code corrupts memory, causing weird segfaults no one knows where because no memory safety
        >most of the backtraces involve your code
        >boss tells you that your code quality dropped since they hired pajeet

        • #154430
          Anonymous
          Guest

          Very similar thing happened to me when a pajeet scrote forcibly broke const rules, the very reason I made the parameter a const so that pajeets can’t break it, yet he still bonked up by const casts and memsets. Somehow I got blamed lol.

      • #154365
        Anonymous
        Guest

        Low readability compared to what? . It’s a pleasure to read compared to C++

        • #154428
          Anonymous
          Guest

          lol

          • #154476
            Anonymous
            Guest

            Explain yourself scrote or admit you’ve never used C++ outside of hello world tier shit

      • #154371
        Anonymous
        Guest

        > and the real world are inherently unsafe.
        C Nile cope is getting more amazing everyday

    • #154358
      Anonymous
      Guest

      Already did and the compiler is so helpful.

    • #154362
      s a g e
      Guest

      no

    • #154364
      Anonymous
      Guest

      Sorry but I am not a trannie scrote.

    • #154366
      Anonymous
      Guest

      Learn C++
      Learn C
      Install KDE
      Install Debian

      • #154370
        Anonymous
        Guest

        Interesting, I didn’t know twitter commies hated GNU and Linux. Why do they want to defend corporate interests?

    • #154367
      Anonymous
      Guest

      >Learn Rust. NOW.
      Dilate. NOW.

      • #154368
        Anonymous
        Guest
    • #154369
      Anonymous
      Guest
    • #154372
      Anonymous
      Guest

      i hate rust so much, i wish it would die in a fire, along with all the trannies who use it.

    • #154376
      Anonymous
      Guest

      I actually quite like rust – the community is absolute cancer though. One of you needs to start a LULZ rust IRC for people who like the language but don’t want to put up with the chud-infested ‘mainstream’ rust community

      • #154378
        Anonymous
        Guest

        I agree. Rust is cool and all, but too many vocal lefty chud types have too much to say. The CoC was suppose to prevent scrotebrained politics in the language, not enforce it.

        • #154393
          Anonymous
          Guest

          >politics were supposed to prevent politics
          did you even read their CoC scrotebrain? Something you’d take out straight from the ass of an actual politician or a gnomish lawyer, someone good at it was paid to write it

          • #154396
            Anonymous
            Guest

            No, I have read this code of conduct. The purpose of such guidelines is to create a social structure where people are afraid to speak their minds and turn over their discernment to the collective. The rules and definitions are somewhat vague on purpose. Is this joke you’re telling too offensive, or is it within the parameters? Who knows, maybe it is today, maybe it isn’t tomorrow. If you say something is stupid, is that "ablerist"? Is it offensive towards the stupid? Perhaps, perhaps not. What about "bald faced lie" and the poor bald people? Are you being offensive in the correct way, which is passive aggressive and snarky, but not specifically touching on the specific, arbitrary points that are "offensive" by the changing definitions?

            Suddenly all sorts of random colloquialisms and figures of speech is something that gets you a reaction where several people begin a sort of "struggle session" with you to "teach" you how to conform to the collective. And perhaps it’s tolerable to you today, but who knows what they will do tomorrow? People who have found this power of pushing individuals around and feel powerful as the "wolf pack" does never relinquish this power. They need to push it further to get their fix.

            Never engage with such groups. They end up like cults.

            • #154397
              Anonymous
              Guest

              take your meds schizo

              • #154399
                Anonymous
                Guest

                Whatever. Maybe you should cut back on the meds. You’re probably young and think this is very new and novel, but I have seen this things before.

            • #154464
              Anonymous
              Guest

              Rust is a cargo cult.

    • #154381
      The Falcon
      Guest
      • #154388
        Anonymous
        Guest

        mmm all those C and C++ libraries available for consumption

        suhweet

        • #154398
          Anonymous
          Guest

          have fun figuring out which thread context the library uses for callbacks or whether you’re supposed to delete this object yourself or if the segfault you got was because you passed a sizeof in bytes instead of an array size or…

          • #154400
            Anonymous
            Guest

            I just read the documentation because I’m not mentally ill

      • #154407
        Anonymous
        Guest

        >C, Python, Java above Javascript
        Yeah, that’s bullshit.

      • #154438
        Anonymous
        Guest

        https://i.imgur.com/8ijcYM1.gif

        Everything under Top 10 is shovelware trash in this list, change my mind

        • #154441
          Anonymous
          Guest

          >visual basic
          >javascript
          >php
          >not shovelware trash
          good programming languages tend not to be popular for the same reason spoken constructed languages tend to be unpopular: no one speaks them. It says nothing about the quality of the language. After all, English is widely spoken despite having incredibly inconsistent pronunciations (for example, ghoti can be pronounced the same as "fish"). English became popular because of the British Empire, not because it’s a good language. Java is popular because oracle spent a lot of money on advertising, C is popular because it came along at the right time and was easier than assembly, C++ is popular because it improved upon C and maintained backwards compatibility, JavaScript because it lucked into being the only language you can run in a web browser. They got popular because of historical accident, whereas a well designed language like Rust can languish in obscurity despite being objectively vastly superior to its competitors.

          • #154453
            Anonymous
            Guest

            https://i.imgur.com/Z4Bm5Ij.gif

            >ghoti can be pronounced the same as "fish"
            gas the intellectuals

          • #154455
            Anonymous
            Guest

            >English became popular because of the
            1611 Authorized Version translation of the Bible authorized by the english king James, with spellings regularized in 1769

          • #154502
            Anonymous
            Guest

            How can someone cope this hard lmao

      • #154439
        Anonymous
        Guest

        >VB more popular than JS
        lmao anon you are funny

      • #154451
        Anonymous
        Guest

        Why did Fortran leapfrog so high?

        • #154454
          Anonymous
          Guest

          because tiobe is utterly meaningless garbage and three people posted fortran shit on HN

      • #154484
        Anonymous
        Guest

        PASCAL IS STILL IN IT BABYYYYY

    • #154384
      Anonymous
      Guest

      I started using Go as a replacement for Python in many places for my personal projects. Then recent tried Rust on a whim for one of them after running into some problems with incompetent memory management in the Go wrapper for a library causing segfaults. Rust ended up being a much better developer experience, even with longer build times the other parts of the language make up for it. Go should be a better developer experience but it was designed by people still living in the 80s when they were relevant. Not that it’s all wins for Rust, but the language has just been better designed.

      Probably the most embarrassing thing of the direct Rust vs Go comparison is that Rust’s channels are all better than Go’s channels. Go’s channels are a bit faster because they’re simplistic, but channels are always going to be slower than just using locks directly so there should be some focus on ergonomics. Go’s channel ergonomics are freaking trash. All Rust channel implementations have moved to returning Errors on send/receive if all receivers/senders have been dropped. None of this "panic on nil
      or "hang forever" bullshit.

    • #154386
      Anonymous
      Guest

      It’s core ideas are trash.

    • #154390
      Anonymous
      Guest

      I already spent 2 years trying to give it a chance but I’ve been constantly hitting roadblocks due to how immature its ecosystem is and recently went back to C++, I wish I could get my time back, but I’m content with objective truth to myself about the evil of the trannies and why everything they touch turns to blood thinned shit.

    • #154391
      Anonymous
      Guest

      did anybody here write that multithreaded rust code that decodes a message using a grid of # in one file and a grid of characters in another file? there may have been some simd optimizations in there as well. was cool code and hoping to see it again to learn from.

    • #154405
      Anonymous
      Guest

      Turns out Rust is better in yet another respect, compared to C: compiled binary size.

      • #154406
        Anonymous
        Guest

        You could disable libc at that point and write raw assembly using asm!.

      • #154413
        Anonymous
        Guest

        >loop{} on panic
        Why would you do this?

        • #154418
          Anonymous
          Guest

          This code example never actually panics, so it is irrelevant what the panic_handler does.
          The ! return type is the never type. You can’t create an instance of it, which means the function never returns.
          So the easiest way to provide a panic_handler implementation is to make it an endless loop. There is also an abort intrinsic, but intrinsics are unstable so you ca’t use them from a stable compiler.

      • #154492
        Anonymous
        Guest

        >compiled binary size
        Hello world is 10 megabytes and 3 megabytes stripped…

    • #154411
      Anonymous
      Guest

      Rust is so fugly and unwieldy that getting used to its idiosyncrasies is just as annoying as in C++, which largely eliminates the benefit.
      >muh safety
      I’ll use Boehm GC or whatever if I need to.

      • #154416
        Anonymous
        Guest

        you’ll use a GC, what about the libs you link to

        • #154422
          Anonymous
          Guest

          It’s a drop in for malloc/free. The point is to be real world usable.

          • #154436
            Anonymous
            Guest

            lol
            how will you trace all GC roots when C code can do whatever the fuck it wants to pointers, such as saving them to floppy as ebcdic records

            • #154440
              Anonymous
              Guest

              I’ll solve this problem by not using shit libraries, which is impossible in Rust where 3/4 of the ecosystem is alpha quality because the devs got bored and quit the language 2 years ago.

              • #154443
                Anonymous
                Guest

                muh I only use high quality code written by virgins
                ONE wrong byte
                that’s all it takes to causes a memory-corrupting bug in your C code
                that’s why large C code bases never have been and will never be bug free

                • #154446
                  Anonymous
                  Guest

                  I never said I don’t make mistakes. Valgrind exists for a reason.

                  • #154449
                    Anonymous
                    Guest

                    think of rust as automatically running valgrind for a hundred trillion billion years exercising all code paths and possibilities

                    • #154456
                      Anonymous
                      Guest

                      Then it turns out some idiots overused unsafe in half of your libraries to speed them up, and replacing them takes more work than using C++ would have been because C++ libraries have the maturity advantage.

                      • #154457
                        Anonymous
                        Guest

                        Sounds like whataboutism, what kind of libraries have half of them written in unsafe brackets?

                        Unsafe is not inherently bad, it’s great it can be contained in the smallest place possible, instead of everything being unsafe by default.

                      • #154458
                        Anonymous
                        Guest

                        "If used responsibly" is the most meaningless phrase of all time.
                        I really want to like Rust but it’s simply not going to get people to drop C++ when it’s just as gross and weirdly designed. People prefer the horseshit they’re familiar with.

                      • #154460
                        Anonymous
                        Guest

                        doesn’t matter
                        the pajeet argument applies
                        you tell pajeet to not use unsafe, easy enough to check
                        THEN if it crashes it’s your fault

                      • #154461
                        Anonymous
                        Guest

                        This kind of ultimate
                        >I’ll die eventually, so might aswell kill myself now
                        thinking is what’s wrong with people. More better is objectively better than none.

                • #154459
                  Anonymous
                  Guest

                  >ONE wrong byte
                  Even in an extremely safe language, a dependently typed one even, you could still have memory corrupting problem due to a cosmic ray flipping the wrong bit. It’s better not to have "safe" languages at all, because safety doesn’t exist in a radioactive universe. We should use unsafe languages and write dangerous code in the knowledge that anything could catastrophically fail at any time. Nothing that can’t fail without killing people should be controlled directly by a computer. If a computer can fire the missiles you’ve already lost, it should be a mechanical system operated by a person.

                  Won’t just enum suffice?
                  Enums in rust are basically a tagged unions that can contain multiple types.
                  Eg:
                  https://docs.rs/serde_json/1.0.68/serde_json/enum.Value.html

                  Enums can be used for something similar, but notice that the polymorphic return type of out is a. The type information in a value of Proxy a is preserved unlike in a sum type, so returning a tagged union of Int, Bool and String would not be the same thing. The type signature of this would look like
                  fn out<T> (_: Proxy<T>) -> T

                  in Rust.
                  You get a similar type signature for taking the head of a list which is easy enough in rust, so I’m sure Rust’s type system is expressive enough for this.

                  • #154462
                    Anonymous
                    Guest

                    >it’s okay to write junk cosmic neutroooons flip bits anyway

                  • #154470
                    Anonymous
                    Guest

                    >fn out<T> (_: Proxy<T>) -> T
                    Alright. You can accomplish this in two ways. You can create a generic trait with Foo<T> that had method fn out(_: Proxy) -> T, (or just use Into<T> trait) and write a procedural macro that implements it for each enum variant type.

                    Or you can use Box<dyn Any> that has this functionality out of the box using downcast<T> method and can contain any type(‘static).

                    btw, exapanding further on […]
                    out is monomorphized at compile time, unlike with an enum since the tag is checked at runtime and unlike […] which is just a dynamic type check.

                    >out is monomorphized at compile time, unlike with an enum since the tag is checked at runtime and unlike

                    check’d


                    else {} is not exhaustive?
                    In Go this is just
                    switch c.(type) {
                    case int:
                    c = 4
                    case bool:
                    c = true
                    case string:
                    c = "hello"
                    } which is just a dynamic type check.
                    But how can you know in runtime what type does this proxy carry? Is your proxy actually just a container like:
                    struct Foo<T>(T);

                    If so and if you want to implement some functionality only for specific T, you can just
                    impl Foo<String> {

                    }

                    • #154472
                      Anonymous
                      Guest

                      Proxy doesn’t contain anything, its type parameter is a phantom. It’s a bit like a static enum I guess. The example I gave is not really useful (well, I suppose you could use it for function overloading, but typeclasses/traits are a better way to do this). This kind of thing is actually quite useful in type-level programming and can do things typeclasses/traits can’t in more sophisticated examples.

                      • #154475
                        Anonymous
                        Guest

                        So, do you just want something like Default trait?

                  • #154485
                    Anonymous
                    Guest

                    >It’s better not to have "safe" languages at all, because safety doesn’t exist in a radioactive universe. We should use unsafe languages and write dangerous code in the knowledge that anything could catastrophically fail at any time.
                    Maybe a couple trillion bit flips might magically make C work.

        • #154426
          Anonymous
          Guest

          boehm replaces the allocator. libraries will use it too.

    • #154414
      Anonymous
      Guest

      no, i don’t think i will

    • #154417
      Anonymous
      Guest

      why isn’t there something like openframeworks/libcinder/globject for rust? At most you find nannou but that just gives you raw wgpu and not the nice abstractions (also it takes ages to compile).

      • #154487
        Anonymous
        Guest

        That’s what’s stopping me from maining Rust
        Might as well use Haskell’s GLOSS

    • #154419
      Anonymous
      Guest

      why are trannies such authoritarians? always trying to force others to do things

      • #154420
        Anonymous
        Guest

        Imagine if you cut off your dick to fit in with your scrote friends on discord, you’d be butthurt and looking to take it out on someone as well.

    • #154421
      Anonymous
      Guest

      for the vast majority of programs js is perfectly fine and it has the advantage of also being used on the web

      • #154423
        Anonymous
        Guest

        Who and what the fuck is Matz doing?

        • #154474
          Anonymous
          Guest

          The Joy of Programming

      • #154424
        Anonymous
        Guest

        What an awful diagram, I’ve no idea how to interpret it

      • #154429
        Anonymous
        Guest

        huh?
        Rust is faster than C on 7/10 benchmarks on benchmark game
        why has this got Rust apparently slower than C?

        • #154467
          Anonymous
          Guest

          at worst it’s 2% slower because it’s 100% correct
          most C code doesn’t handle UTF-8 or long file name edge cases or properly check return codes, hence the endless exploits

    • #154431
      Anonymous
      Guest

      >benchmarking diagram without sources or references

      seems legit

    • #154433
      Anonymous
      Guest

      Not him, and haskell because I’m not sure how to do this in Rust, but here’s an example of pattern matching that cannot be replaced with if-else statements
      {-# LANGUAGE GADTs #-}
      {-# LANGUAGE FlexibleInstances #-} — needed for Eq instance

      data Proxy a where
      PInt :: Proxy Int
      PBool :: Proxy Bool
      PString :: Proxy String

      out :: Proxy a -> a
      out c = case c of
      PInt -> 4
      PBool -> True
      PString -> "hello world!"

      It’s probably possible to do something similar in Rust with associated types, but I’m not sure.
      We could try and do this with if-else statements and get a compiler error.
      instance Eq (Proxy Int) where _ == _ = True
      instance Eq (Proxy Bool) where _ == _ = True
      instance Eq (Proxy String) where _ == _ = True

      out’ :: Proxy a -> a
      out’ c =
      if c == PInt then
      4
      else if c == PBool then
      True
      else "hello"

      This approach can’t work, because the compiler can’t know that c can be compared to something of type Proxy Int, when c’s type is Proxy a for some a which could be Int, String or Bool. In general, pattern matching gives the compiler more information about types, and not only that be it results in a compiler error (in rust) or warning (in haskell) if you don’t cover all possibilities in a pattern match expression, which if-else expressions can’t

    • #154435
      Anonymous
      Guest

      >Learn Rust. NOW.
      Not a pedo.
      I don’t have petabytes of CP on remote inaccessible disks.
      I’m not mentally ill.
      Not planning on cutting off my dick, ever.
      >You’ll never pass as a woman, ever.
      >You’ll never, ever have a period
      >You’ll never, biologically speaking, give birth to a child.
      >You’ll suicide and join the other 41%.
      >You’ll never be a woman, ever.

    • #154477
      Anonymous
      Guest

      Im sick and tired of y’all telling yourself that the language(s) you know are the best.

      Admit they all have pros and cons, that they are good for different things, and that they are not prefect. There is no language of the future that will replace everything else.

      Tips for language stans: learn and *use* multiple languages.
      You don’t have to be able to write compile time tetris from memory.

      DIVERSIFY AND MAKE YOURSELF USEFUL!

      For example I know:
      * C++, Java, Python, JS, and Go very well
      * C, C#, Rust, PHP, and Swift enough to do jobs in it

      At my current job, I do like 85% Java but I still have to do things in Python, JS, Rust, and C/C++ all the time.

      Once you know like 2 or 3, you can learn them really quickly, and them as you have a use for them, dont try to build a webserver in C or an embedded system in Swift.

      • #154478
        Anonymous
        Guest

        I know twice as many languages as you and maybe I can’t tell which one is the best I am 100% sure Go is shit with no pros.

        • #154479
          Anonymous
          Guest

          Tf image u want me to put?
          >The Lisp Alien?

          • #154481
            Anonymous
            Guest
      • #154480
        Anonymous
        Guest

        it’s not about "learn only rust and nothing else"
        learning to use rust and understanding lifetimes and why you get borrow checked will make you a better programmer
        it’s about morons that get cucked by the rust compiler, then going back to shit they already know "because they already know how to write safe code", missing the point that no, they do not

        • #154494
          Anonymous
          Guest

          Rust is for "programmers" who got filtered by memory management – the most important thing a programmer should ever know how to do.

          • #154504
            Anonymous
            Guest

            imagine being this freaking oblivious holy shit

            • #154505
              Anonymous
              Guest

              don’t worry, sub-kloc brainlets cannot understand

            • #154506
              Anonymous
              Guest

              t. filtered one

    • #154482
      Anonymous
      Guest

      haven’t something like 41% of their language developers killed themselves since the beginning of the project?
      I’ll stick with c++

    • #154488
      Anonymous
      Guest

      Rust ftw

    • #154489
      Anonymous
      Guest

      Someone please, without meming, tell me the benefits of learning this language, for someone completely new to programming after learning python. I heard it’s only good for crypto jobs and microcontrollers (don’t know what that last thing is).

      Like why should I learn this? I got a free course offer to learn this and haven’t picked it up yet since I don’t know what’s the appeal. Someone please spoon feed me.

      • #154495
        Anonymous
        Guest

        >Someone please, without meming, tell me the benefits of learning this language
        It’s more efficient than C (less code, less RAM, faster, smaller binaries). It prevents a lot of common bugs. Firefox uses it. Amazon and other big companies are looking at it because it’s a big improvement over C/C++.

        • #154496
          Anonymous
          Guest

          >It’s more efficient than C (less code, less RAM, faster, smaller binaries). It prevents a lot of common bugs. Firefox uses it. Amazon and other big companies are looking at it because it’s a big improvement over C/C++.
          Is it used for everything though? Like all things, not just crypto and microcontrollers? Because that’s a common theme and reason I see people take it up for

          • #154498
            Anonymous
            Guest

            None of that was true btw. It’s a shitty mishmash of features taken from other languages, more RAM usage, slower, significantly larger binaries (a hello world is 3 megabytes), and every rust crate is amateurish and full of bugs.

            • #154499
              Anonymous
              Guest

              >None of that was true btw. It’s a shitty mishmash of features taken from other languages, more RAM usage, slower, significantly larger binaries (a hello world is 3 megabytes), and every rust crate is amateurish and full of bugs.
              So no point of learning it then?

              • #154500
                Anonymous
                Guest

                Not until it improves quite a bit. If I was forced to choose a new language in the same vein, I’d probably go with D instead.

    • #154490
      Anonymous
      Guest
      • #154497
        Anonymous
        Guest

        Just use one of the many other 0.0.1-alpha rust game engines sis.

        Or realise that rust is the ultimate rugpull lang and stick with languages/engines that have actual proven longevity.

    • #154491
      Anonymous
      Guest

      Stop promoting Rust to scrotebrained cniles.
      I don’t want them in Rust community.

    • #154501
      Anonymous
      Guest

      I actually considered learning rust but because of how shilled it is here I decided I’m better off learning another compiled language

    • #154503
      Anonymous
      Guest

      when will you join the 41%, chud chud?

Viewing 41 reply threads
  • You must be logged in to reply to this topic.