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.
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.
For developers dont know how to write if thens maybe.
Printing verbose text to standard out is still the standard when dealing with intractable APIs with bizarre error codes and improperly named methods, sequential coupling, and all the other miniature nightmares from legacy systems with no documentation or support
log = new Logger('aThing');
log.debug('I am debugging it');
log.warn('It is a warn');
log.info('I am informing you');
log.error('There is an error here');
log.critical('It is worse');
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.
called. They want their macros back.
Is a way to print the type of an expression.
Due to various reasons it's sometimes not clear what the exact type of an expression will be, so you have to give it an invalid type so the compiler will complain with the real type, and then you can copy paste that one.
Kind of annoying.
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.
When someone has cancer and it cripples them, "is cancer really all you have to complain about?" is a really stupid statement. SJWs (social terrorists) are societal cancer. We're doctors working on a cure for cancer, not Nazis working on something that sounds like "glass of juice." Stop being an obtuse twatwaffle with a knucklephilic face.
At some point, I hope they actually manage to get the language to actually build on different operating systems correctly. Go is trivial to port.
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
Indeed, and C is for wanna-by coders who can't write reliable, secure assembly.
Curious, though. This is possibly the first time that I have ever heard Rust being called "dumbed-down". Much more common to hear people complain that its too hard.
Even if they are cancer, and not just some pretend "bogeyperson" you all dreamed up to have something to be mutually upset about, you don't fight cancer with more cancer.
I thought rust was a modern language. Why are we still debugging with print?
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.
Indeed, and C is for wanna-by coders who can't write reliable, secure assembly.
Actually, the idea behind C wasn't to make code more reliable (you can fuck up in C at least as easily as in assembler). The idea was to make programming less tedious.
I still learnt assembler in university. Kids nowadays learn programming with Java, that should be a crime. I've written 1000 lines assembler code that I could do in 50 lines in C. That's what C is for. Then a few more modern languages emerged that could do things C does in 50 lines in 5 - because, for example, automatic memory management, string functions, built-ins. And then it stopped. Everything since then was just trying to make new programming languages do the same thing in the same way with a different syntax.
IMHO there are five languages you need to know, and you know them all: Assembler, C, C++, Lisp and Prolog.
Everything else is just different syntax for one of them.
Assorted stuff I do sometimes: Lemuria.org
I'm a nerd and interested in programming languages... And fuck anyone here who isn't
A tough nerd. Now I've seen everything.