Announcement

Collapse
No announcement yet.

Rust 1.32 Released With New Debugger Macro, Jemalloc Disabled By Default

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

  • #31
    Originally posted by cybertraveler View Post

    Do you know if there is a practical benefit to C's design here (assignment yielding a return value)?
    Yes. The biggest advantage is, syntactically you can inline some assignments inside if/while loops or assign multiple values like a = b = c = 42;. There are also cases where you have C/C++ as the target language and supporting this helps with C/C++ code generation. If there used to be any differences in code generation, those days are long gone since gcc 4. I'd argue the advantages don't really outweigh the problems anymore. Fixing these bugs is really expensive these days.

    Comment


    • #32
      Originally posted by caligula View Post
      Fixing these bugs is really expensive these days.
      Only if you hire the trash el cheapo "programmers" and then have the burden to deal with their low quality brain.

      Seriously there's no other way I can put this for mistaking = and ==

      Comment


      • #33
        Originally posted by Weasel View Post
        Only if you hire the trash el cheapo "programmers" and then have the burden to deal with their low quality brain.

        Seriously there's no other way I can put this for mistaking = and ==
        It must be nice always working with geniuses who never have any typos or create any bugs. Wish I was that lucky.

        Comment


        • #34
          Originally posted by smitty3268 View Post
          It must be nice always working with geniuses who never have any typos or create any bugs. Wish I was that lucky.
          Honestly, and with no sarcasm intended at all, I'm baffled that the bar for a "genius" has been lowered so much these days. It's sad.

          Comment


          • #35
            Originally posted by caligula View Post
            Not everyone has the privilege to use latest modern compilers. Take an embedded environment that's stuck with gcc 2 or 3 (was common few years ago). Now the general guideline was to compare in a way that the rvalue is on the left hand side. So e.g. 1 == x. Now if you make a mistake and type 1 = x, it won't compile. I'm not sure about the status of the NDA so can't paste the code style guide here. Many juniors also do this on purpose cause they don't know the difference. I think it's better to use languages where assignment doesn't yield a return value. That's a code smell anyways.
            And how do you plan to run swift on that enbedded environment if you can't even get gcc4 on it?

            Comment


            • #36
              Originally posted by Ansla View Post

              And how do you plan to run swift on that enbedded environment if you can't even get gcc4 on it?
              1) I wasn't advocating Swift
              2) Even if it doesn't exist (yet), that doesn't prevent me from explaining why some language improvements are so useful. There wouldn't be any progress if everyone thought like you.

              Comment


              • #37
                Originally posted by Ansla View Post

                And how do you plan to run swift on that enbedded environment if you can't even get gcc4 on it?
                Besides, look at these
                https://github.com/avr-rust/
                https://github.com/avr-rust/ruduino

                Comment


                • #38
                  Originally posted by caligula View Post

                  1) I wasn't advocating Swift
                  2) Even if it doesn't exist (yet), that doesn't prevent me from explaining why some language improvements are so useful. There wouldn't be any progress if everyone thought like you.
                  1) You were advocating languages that behave like swift, as a solution for an issue that had nothing to do with the language, but with very old compiler.
                  2) Usualy lack of some feature is not considered an improvement.

                  Originally posted by caligula View Post
                  Why would I? I never said rust (or even swift) can't be used on any embedded setup. Just that on setups where you can use them you also can use lastest gcc or clang.

                  It's just ridiculous to argue that some shiny new language comes to fix some issues that the C language had during the previous millenium, that were fixed by C compilers 10 or even 20 years ago.

                  Comment


                  • #39
                    Originally posted by caligula View Post

                    Yes. The biggest advantage is, syntactically you can inline some assignments inside if/while loops or assign multiple values like a = b = c = 42;. There are also cases where you have C/C++ as the target language and supporting this helps with C/C++ code generation. If there used to be any differences in code generation, those days are long gone since gcc 4. I'd argue the advantages don't really outweigh the problems anymore. Fixing these bugs is really expensive these days.
                    Also, having every language construct be an expression (something that returns a value) rather than a statement (something that must stand on its own) can simplify the language and enable elegant code flows. What counted as elegant in C's design time might count as dangerous gotcha nowadays, but it's not hard to find code that does "assign and test" on purpose.

                    For what it's worth (to stay somewhat on topic), assignment are expressions in Rust too, but to prevent problems, their value is always `()` (the unit tuple).

                    Comment


                    • #40
                      Originally posted by Weasel View Post
                      Is this really a thing? An issue?
                      Ok, so you don't have much experience in programming. Don't lie to yourself in pretending you have, that's not the only tell-tale quote.

                      Nothing wrong with lack of experience, that's something that only time can bring.

                      Even if you make such an obvious mistake, compiler will warn you about it. I don't see the problem and it's obvious as fuck.

                      [...]

                      Only if you hire the trash el cheapo "programmers" and then have the burden to deal with their low quality brain.

                      Seriously there's no other way I can put this for mistaking = and ==

                      [...]

                      No need to apologize, Rust dummies deserve it.
                      Lambasting other people, including highly skilled and experienced language designers and compiler writers, on a subject that you seemingly just encountered ? That's pretty bad.

                      Throwing insults at large groups of people in each of your posts ? That's unacceptable.

                      I don't know if you or your company manages to find decent programmers, but you should realize that these posts put you instantly in the "low tech skill - don't hire as programmer" and (more importantly) "horrible personal skill - don't hire for any job description" categories. It's never too late to change. Please be polite, constructive, humble.

                      Seriously, where are the moderators ?

                      Comment

                      Working...
                      X