Slashdot Mirror


Rust 1.32.0 Stable Release Includes New Debugging Macro, 'Quality of Life' Improvements (rust-lang.org)

An anonymous reader summarizes the changes in Thursday's release of Rust 1.32.0 stable: "Quality of life" improvements include a new dbg macro to easily print values for debugging without having to use a println statement. For example, dbg!(x); prints the filename and line number, as well as the variable's name and value, to stderr (rather than to standard output). Making it even more useful, the macro also returns the value of what it's debugging -- even all the boolean values returned by each execution of an if-then statement.

Rust macros can now match literals of any type (string, numeric, char) -- and the 2018 edition of Rust also allows ? for matching zero or one repetitions of a pattern.

In addition, all integral numeric primitives now provide conversion functions to and from byte-arrays with specified endianness.

8 of 96 comments (clear)

  1. Why Rust by 110010001000 · · Score: 3, Interesting

    Why did they call a language "Rust"? Did they think that was descriptive, or cute, or what? Is it an acronym? I understand things like "Swift" and "Go", but "Rust"doesn't make any sense.

  2. Re:Quality of life by serviscope_minor · · Score: 3, Insightful

    People here used to be excited or at least interested/thoughtful about real actual nerdy news.

    Now it doesn't matter the topic of conversation, the perpetually offended snowflakes cannot shut up about SJW. Bleh.

    If one ignores the hype, the fanbois, the haters and the plain stupid, Rust is an interesting language. It's the first credible attempt to displace C++ in areas where C++ is king. And by credible, I mean not designed by someone who clearly hates and or plain doesn't understand C++ and can't see why it's used.

    It's not a perfect lanaguage and it's not a panacea (fucking duh) but it makes some of the knottier problems of C++ go away, especially in certain domains and it's given the C++ community interesting things and directions to think about. So yeah it's interesting because I'm a nerd and interested in programming languages.

    And fuck anyone here who isn't. News for nerds.

    --
    SJW n. One who posts facts.
  3. Can the devs do it themselves? by MarchHare · · Score: 2

    Did he Rust maintainers have to implement the dbg!() method, or could any Rust dev add their own? I know in Ruby I could have created my own:

    def dbg!(x)
          STDERR.print "#{__FILE__}:#{__LINE__} #{x.inspect}\n"
          x
    end

    Just curious, don't know how flexible Rust is when it comes to extending the language itself.

  4. In theory, a fungus by SuperKendall · · Score: 2

    No joke, supposedly named after a fungus.

    And you know the answer is right, since it comes from Stack Overflow!

    Which on the other hand references Reddit, so... hmm.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  5. Re:Quality of life by Sesostris+III · · Score: 2

    I do wonder how many whingeing about this are actually coders.

    I too am interested in Rust and, indeed, any new language. I'm always curious to know which ones will thrive and which ones won't, and what the use-cases for each are, in other words, where would you use one rather than the other.

    I'm not altogether sure of the relevance of 'SJW' is to this technically, especially as the term seems to be applied as a term of abuse (by others) rather than a term of self-identification (so in this case presumably used by those not involved in the development of the language).

    I think my main objection so far to Rust is that I can't just download a tarball, unzip, set up some environment variables, and run. It seems that you have to run an installer, which I really dislike! But that's me.

    --
    You never know what is enough unless you know what is more than enough. - Blake
  6. Re: Quality of life by swillden · · Score: 3, Interesting

    Your first error was in assuming C++ is replaceable. You can stop using C++ and use something else because C++ is good at one thing and better than anything else at that one thing. Don't want C++? Choose the best choice. You don't use a language to replace another language. You use a language because its what you want.

    Nonsense.

    For any given context, there is no single perfect language. There are always different options, with various pros and cons. And as the options and the context both change over time, it often does begin to make sense to replace one language with another. The value of the new language has to be very significant to justify rewriting working code, though.

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  7. Re:Quality of life by serviscope_minor · · Score: 2

    There are areas where the utterly borked C++ is king?

    Yep. Areas populated by grown-ups, who need performance but for some inexplicable reason don't want to spend all their time micromanaging a computer by hand when it can be done programmatically.

    Even C now depends on C++. All the compilers people actually use (the ones with decent optimizers) are writen in C++ now.

    C++ has its share of warts, but anyone who thinks it's "utterly borked" is flat out ignorant.

    --
    SJW n. One who posts facts.
  8. No the "first credible attempt" by chris-chittleborough · · Score: 4, Informative

    No, there is an earlier "credible attempt to displace C++": D. D was created by Walter Bright, who previously was "the main developer of the first C++ compiler to translate source code directly to object code without using C as an intermediate language" (quoting Wikipedia), and so is clearly "credible" by your criteria.

    The thing about Rust is that the ownership/borrowing system makes it better than C++ in important ways. Programmers have to specify variable usage details, but this (1) makes the code easier to maintain, (2) gives you a much more powerful form of RAII, (3) makes reference counting work so well that you don't need a tracing garbage collecter, and (4) makes the resulting code significantly faster in many cases. That is why Rust should compete successfully with C++, whereas a "C++ without the warts" like D could not.