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.

96 comments

  1. Quality of life by Anonymous Coward · · Score: 0

    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

    1. 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.
    2. Re: Quality of life by Anonymous Coward · · Score: 0

      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â(TM)t want C++? Choose the best choice. You donâ(TM)t use a langauge to replace another language. You use a language because its what you want. In addition, the people who get bright ideas to create a Portmanteau of previous languages are unusually ineffective and probably just want to invent for the sake of inventing without understanding what the point of any of the language features really are.

    3. Re:Quality of life by Anonymous Coward · · Score: 0

      ... someone who clearly hates and or plain doesn't understand why people use C++ ...

      Here, here!

      CAP === 'parties'

    4. Re:Quality of life by Anonymous Coward · · Score: 0, Funny

      Is there anything you old faggots have to whine about besides SJW, or is that like the epitome of your toothless ideological rage?

      <SIR_DAVID_ATTENBOROUGH_VOICE>

      Here we see the hypocritical hatred of the SJW making its appearance.

      This time, it's homophobic hate. But next time, it may very well be racist hatred.

      When we observe the SJW in its natural habitat, we often see it display a tremendous blind spot as it acts out in the very ways it says are wrong. For example, we often observe SJWs calling others, "Raaaacis'!!!" while at the same time it virtue signals to the rest of its troop of semi-intelligent primate-wannabes by demanding racial quotas.

      It's somewhat like a blind peacock, showing off its feathers to other peacocks - and walking off a cliff to its death.

      Or, as in this case, we see a SJW calling someone the homophobic slur "faggot".

      </SIR_DAVID_ATTENBOROUGH_VOICE>

    5. Re:Quality of life by LynnwoodRooster · · Score: 0

      I can't believe how intolerant and divisive Rust is with "if-then" logic! What about the millions of people who are indecisive, why not "if-maybe" structures?

      --
      Browsing at +1 - no ACs, I ignore their posts. So refreshing!
    6. Re:Quality of life by Anonymous Coward · · Score: 0

      ^^ Found the libertarian crybaby.

      Get a rope.

    7. Re:Quality of life by Anonymous Coward · · Score: 0

      Like you bleating about Trump all day? Talk about irony. Spending your life screeching at the slashdot users you stalk is the epitome of TRIGGERED BITCH, you lonely fuckface.

    8. Re:Quality of life by Anonymous Coward · · Score: 0

      Is there _ANYTHING... AT ALL_ you old faggots have to whine about besides SJW, or is that like the epitome of your toothless ideological rage? Or is it constant whining until Trump hangs for treason either way?

    9. Re:Quality of life by Anonymous Coward · · Score: 0

      Trunp! Trump! haha, repeat yourself again, you autistic piece of shit.

    10. Re:Quality of life by Anonymous Coward · · Score: 0

      Is there _ANYTHING... AT ALL_ you old faggots have to whine about besides SJW, or is that like the epitome of your toothless ideological rage? Or is it constant whining until Trump hangs for treason either way?

    11. Re:Quality of life by Anonymous Coward · · Score: 0

      YHBT.

      ... we see a SJW calling someone the homophobic slur "faggot".

      No, we really don't.

    12. Re:Quality of life by gweihir · · Score: 1

      Rust is an interesting language. It's the first credible attempt to displace C++ in areas where C++ is king.

      There are areas where the utterly borked C++ is king? That language is so badly designed it is staggering.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    13. Re:Quality of life by gweihir · · Score: 1

      Indeed! We need to ban the discriminatory if-then construct! And what about other actions that are left out completely? This cannot stand. We need a "do everything" construct and drop all this other toxic nonsense.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    14. Re:Quality of life by LynnwoodRooster · · Score: 0

      Don't even get me started on the privilege of the dominant patriarchy implied by the use of a GOTO statement...

      --
      Browsing at +1 - no ACs, I ignore their posts. So refreshing!
    15. Re:Quality of life by Anonymous Coward · · Score: 0

      I'm legitimately curious as to what evolutionary purpose these displays may serve, which would account for the SJW not having gone extinct yet. Indeed, they seem to be a "Least Concern" species today. Then again, dinosaurs once ruled the earth, but most species that ever lived are extinct today.

      Well-deserved satire aside, arguably the thought process of the SJW is a memetic organism, very much akin to a biological disease. You might be on to something.

    16. Re:Quality of life by Anonymous Coward · · Score: 0

      The use of binary in computers at all is oppressive and transphobic. We need to move to analog computers! Also, don't even pretend to understand the struggles of downtrodden minorities who are oppressed by racist sexist homophobic cis het white male goto and if-then constructs! Stop trivializing minorities and oppressing women!

      (Note to mods: satire)

    17. Re:Quality of life by LynnwoodRooster · · Score: 0

      Truly, fuzzy logic with an infinite range of diversity between zero and one, is the highest, ethical form of any type of suggesting (in that we can no longer call it programming because of the implied dictatorial control and conformity by the very word itself).

      --
      Browsing at +1 - no ACs, I ignore their posts. So refreshing!
    18. 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
    19. Re:Quality of life by Anonymous Coward · · Score: 0

      Spotted an ignorant.

    20. 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.
    21. Re:Quality of life by Desler · · Score: 1

      Do you need a safe space, snowflake?

    22. Re:Quality of life by swillden · · Score: 1

      Rust is an interesting language. It's the first credible attempt to displace C++ in areas where C++ is king.

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

      Lots and lots of them. Basically anywhere you need the low-level performance and control of C, but need the greater productivity provided by an object-oriented language.

      That language is so badly designed it is staggering.

      C++ wasn't designed so much as accreted. However, if you look at modern C++, there is a smaller, cleaner, safer language emerging. Using it requires discipline since you need to avoid all of the other stuff that's still there because it can't be taken away. I'm actually really enjoying C++ since C++11, and it's still getting better.

      That said, I'm also very interested in Rust as an alternative. It seems to hit the same targets as C++, and it doesn't carry C++'s baggage.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    23. 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.
    24. Re:Quality of life by serviscope_minor · · Score: 1

      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.

      The reason for rust's existence is to write irregular, fine grained multithreaded code in a language that basically has the same machine and memory model as C++, with zero overhead abstractions etc. Multithreading is notoriously hard and C++ doesn't provide any solid tools to avoid races. Rust has the entire type system bent to that cause (that also rules out memory errors).

      It was created by Mozilla to write Firefox because they couldn't get a multithreaded browser engine working in C++ with fine grained multithreading. Actually no one managed despite having substantially larger teams. Only Mozilla has one now, because of their rust effort.

      So not too surprisingly, rust is the best language for the task it was specifically created for. Whether it escapes that niche substantially remains to be seen. Most problems aren't as hard as writing a multithreaded browser engine.


      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).

      No idea. People seem to be hurling it around as an all purpose insult. There's no coherence to it's use. They could equally likely be objecting to the borrow checker Ed the code of conduct.

      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 can't do that with a C compiler either. You have to run the compiler's installer before you can build the compiler. Standard bootstrap problem: rustc is written in rust. Or do you mean that the binary requires and installer? If so that's just lazy and there's no excuse.

      If one compiles gcc and does a make install to some clean directory, you can tar that up and ship it. And it just runs, no environment variables needed. It uses rpath stuff to locate the .so files and figure from that where the headers are. Very neat.

      --
      SJW n. One who posts facts.
    25. Re:Quality of life by jma05 · · Score: 1

      > 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 could start with
      https://play.rust-lang.org/
      No need to download anything at all.

      From what I remember (it has been a while since I ran rustup-init.exe), Rust installer does not need admin privileges and does not have a registered uninstaller. All it seems to do is download, unzip and just adds to path (No new environment variables by default. You set them if you want to override).

    26. Re:Quality of life by jma05 · · Score: 1

      > 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.

      This might interest you too
      https://forge.rust-lang.org/ot...

    27. Re:Quality of life by Tom · · Score: 1

      Me, me, me!

      I'm an old C and C++ guy. I've ignored all the nonsense that was invented after I went to university, and I still shake my head at Node.js and having been forced to actually use it for a prototype project, not out of ignorance. I write a lot of stuff in PHP these days because it's C-like (plus just the right amount of OO, the only thing I'm missing from C) and because for web-programming there's no good C solution.

      Rust is the only new programming language that actually interests me. It's the only thing that appears to be doing things the right way.

      You're not the only one excited about nerd news. :-)

      --
      Assorted stuff I do sometimes: Lemuria.org
    28. Re:Quality of life by Sesostris+III · · Score: 1

      Thanks. I did download the one for Linux before posting. Their being an 'install.sh' at the top level of the extracted archive promptly put me off! I would need to see what it does before I run it or try to work round it.

      --
      You never know what is enough unless you know what is more than enough. - Blake
    29. Re:Quality of life by Sesostris+III · · Score: 1

      Or do you mean that the binary requires and installer? If so that's just lazy and there's no excuse.

      Yep, that's me, Lazy. Strangely I find don't need an excuse for being that!

      Actually, I will get round to trying to install locally at some point. I think I compare it to Java or Go, where I can just download, extract, add one item to the $PATH environment variable, and then go.

      --
      You never know what is enough unless you know what is more than enough. - Blake
    30. Re:Quality of life by Sesostris+III · · Score: 1

      Yes, I will run it locally. I'm sure it will complain if it can't install locally.

      --
      You never know what is enough unless you know what is more than enough. - Blake
    31. Re:Quality of life by serviscope_minor · · Score: 1

      Yep, that's me, Lazy.

      Well I wasn't calling you lazy. However since you didn't bother to read what I wrote, I might now... :)

      Actually, I will get round to trying to install locally at some point. I think I compare it to Java or Go, where I can just download, extract, add one item to the $PATH environment variable, and then go.

      I was comparing to GCC which doesn't need the environment variable.

      --
      SJW n. One who posts facts.
    32. Re:Quality of life by gweihir · · Score: 1

      You have nothing to say but could not keep your mouth shut? You should complain to your parents for failing in your upbringing...

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    33. Re:Quality of life by gweihir · · Score: 1

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

      Lots and lots of them. Basically anywhere you need the low-level performance and control of C, but need the greater productivity provided by an object-oriented language.

      That one is a myth. This "greater productivity" does not exist. It is however that lots of semi-smart people went looking for it, and then found they could not back out again. In true human fashion, they then claim that the mistake they made was actually a good move.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    34. Re: Quality of life by gweihir · · Score: 1

      Indeed. One of the few actually insightful statements so far. Also, very often a specific language is used because it is hyped or because the developers you have cannot do anything else.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    35. Re:Quality of life by gweihir · · Score: 1

      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.

      Since one does not have to do anything with the other, you are clearly clueless. Just could not keep silent, could you?

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    36. Re:Quality of life by gweihir · · Score: 1

      However, if you look at modern C++, there is a smaller, cleaner, safer language emerging. Using it requires discipline since you need to avoid all of the other stuff that's still there because it can't be taken away. I'm actually really enjoying C++ since C++11, and it's still getting better.

      Well, that is good to know. Of course, they should pack all the problematic stuff away into some "#pragma oldstuff" or the like and define a clean, simple and clear core language. Then I would take another look. Don't get me wrong, I do know that there is a sane core in there in C++, the problem is just that most people working in C++ do not know this or understand what it is and end up using and abusing the really problematic stuff. Also, have they finally fixed the virtual function dispatch performance mess?

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    37. Re:Quality of life by gweihir · · Score: 1

      How can you be so unethical! All the negative number are left out! They already go through life with the stigma of being negative and now you just ignore them! Instead they should be celebrated and elevated in affirmative action! I propose therefore that the privileged positive number be dropped altogether and to use fuzzy logic based entirely on negative numbers!

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    38. Re:Quality of life by Anonymous Coward · · Score: 0

      In true human fashion, they then claim that the mistake they made was actually a good move.

      I only make the best deals, believe me; I'm, like, a smart person.

    39. Re:Quality of life by Anonymous Coward · · Score: 0

      You think that's bad - take a look at PHP

      echo "Hello world" or die;

    40. Re:Quality of life by LynnwoodRooster · · Score: 1

      We are BOTH so heteronormative and blinded by our white privilege! We are completely overlooking our friends in the imaginary number space! With the unicorns and elves, the imaginary numbers must be used in our suggesting. And we cannot default to just English letters, as that shows our oppressive Western idealism being considered superior to all other cultures. We must open the suggesting instructions to use any language, including those not yet expressed!

      --
      Browsing at +1 - no ACs, I ignore their posts. So refreshing!
    41. Re:Quality of life by serviscope_minor · · Score: 1

      you are clearly clueless.

      Says the guy who doesn't see why people use C++ despite his favoured language depending on C++ infrastructure.

      --
      SJW n. One who posts facts.
    42. Re:Quality of life by Anonymous Coward · · Score: 0

      I'm not going to continue the SJW idiocy on my part, because producing that level of stupidity is rather draining to me. I was going to make some joke about how you left out vectors, you scalar-normative oppressor, and all real numbers above 1 (notice I'm being inclusive of numbers with the stigma of being "differently rational"), but I'll let you write it.

    43. Re: Quality of life by swillden · · Score: 1

      Also, very often a specific language is used because it is hyped or because the developers you have cannot do anything else.

      Availability of programmers is one of the most important language features you have to consider when choosing a language for a project. If the language is an absolutely perfect fit, but no one knows it and no one is interested in learning it, it's the wrong choice. In practice, you can usually find people willing to learn most anything, so schedule and cost are additional considerations. If choosing the perfect language will mean three months of ramp-up and one month of development, but an already-known language will mean two months of development time, then the already-known language wins. Well, maybe not, because maintenance. But now you have to consider what will happen if the programmers who've learned the perfect language leave and you have to train another batch.

      In practice, there are a lot of solid, pragmatic, engineering reasons to stick with imperfect but popular and well-established languages that have good ecosystems and user bases. Like C++ :-)

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

      That one is a myth. This "greater productivity" does not exist.

      I have decades of experience proving you wrong on this, including plenty of examples of parallel development of the same or very similar projects in C and C++.

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

      However, if you look at modern C++, there is a smaller, cleaner, safer language emerging. Using it requires discipline since you need to avoid all of the other stuff that's still there because it can't be taken away. I'm actually really enjoying C++ since C++11, and it's still getting better.

      Well, that is good to know. Of course, they should pack all the problematic stuff away into some "#pragma oldstuff" or the like and define a clean, simple and clear core language. Then I would take another look. Don't get me wrong, I do know that there is a sane core in there in C++, the problem is just that most people working in C++ do not know this or understand what it is and end up using and abusing the really problematic stuff.

      Good taste is essential. Of course, that's true in every language. It's just more true in C++.

      Also, have they finally fixed the virtual function dispatch performance mess?

      There's no problem with virtual function dispatch performance. It's very close to optimal; you might be able to beat it by careful organization of vtables to optimize cache usage, but it is precisely an offset load to get the vtable address, then an offset load to get the function address and then jump. And actually ARM and X86 can both accept an offset address as a load or jump target, so it's all done in two instructions.

      The biggest performance hit you get from using virtual functions is that when the compiler can't know statically what function you're going to call, it can't do any optimization of that call. It can't inline stuff, omit saving and restoring of registers the callee won't touch, etc. But this isn't a problem with C++, it's an inherent limitation of dynamic dispatch in a statically-compiled language. JIT compilation can fix it in many cases, but not all, and that adds many other costs. Of course, if C++ compilers can prove that a a potentially-polymorphic call will always go to the same place, they're free to optimize the dynamic dispatch out and proceed with whatever other optimizations are available. And they do.

      But modern C++ tends to focus much less on run-time polymorphism, since in many cases compile-time polymorphism gives you what you need, and allows compilers their full range of optimization options.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  2. Use logger stupid! by Anonymous Coward · · Score: 0

    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');

    1. Re:Use logger stupid! by Anonymous Coward · · Score: 0

      Does your logger print file name, line number and variable name?

    2. Re:Use logger stupid! by Anonymous Coward · · Score: 0

      It depends of the capability of the compiler and the logger for printing these parameters.

      The compiler should generate debug symbols more the features of the logger into the binary for answering your question.

      Without debug symbols in the generated objects, it doesn't help you.

      The programmer won't must manage these three parameters, other case it becomes a messy.

    3. Re: Use logger stupid! by Anonymous Coward · · Score: 0

      Exactly why standard out is indispensable because by definition if you are logging an error, something unpredictable has happened which means whatever the compiler has for debugging output is likely to be insufficient

    4. Re:Use logger stupid! by Anonymous Coward · · Score: 0

      That was a rhetorical question. Most loggers are API (i.e. external libraries that are not part of the language/compiler). So they won't print file name etc. automatically. Therefore, dbg!() is a good idea.

    5. Re:Use logger stupid! by Anonymous Coward · · Score: 0

      That was a rhetorical question. Most loggers are API (i.e. external libraries that are not part of the language/compiler). So they won't print file name etc. automatically. Therefore, dbg!() is a good idea.

      Only if you don't know how to write good C or C++ code.

      It's really not that hard to write a logging API in C or C++ that will include file, line, and even function name.

      Of course, if you aren't a good enough coder to do that, that's probably why you need to use Rust in the first place...

  3. 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.

    1. Re:Why Rust by phantomfive · · Score: 1

      Reportedly because the language doesn't intend to be something new or revolutionary: the authors want to collect the good ideas of past languages, and put them to use. They try to not add features of programming languages that were created in the last decade, for example.

      That doesn't mean the features they choose were implemented in popular languages: some were just implemented in research languages.

      --
      "First they came for the slanderers and i said nothing."
    2. Re:Why Rust by Anonymous Coward · · Score: 1

      Possibly a pun on the fact that it is meant to be close to the metal?

    3. Re:Why Rust by DrXym · · Score: 1

      Nor does Python, Java, Ruby etc. Maybe it's just a distinctive moniker for the language.

    4. Re:Why Rust by Anonymous Coward · · Score: 0

      I think its named after a fungus.

    5. Re:Why Rust by Anonymous Coward · · Score: 0

      Rust Usurps Software Throne
      Rankles Users, So True
      Remotely Useful? Stay Tuned!

      I have more, but I'll stop.

    6. Re:Why Rust by Dutch+Gun · · Score: 1

      Why did they call a language "Rust"?

      To better fit in with all the other terrible names geeks have come up with, of course. Gimp? Ogg Vorbis? Gnu Hurd?

      --
      Irony: Agile development has too much intertia to be abandoned now.
    7. Re:Why Rust by Anonymous Coward · · Score: 0

      Of all the things I've heard people hate on Rust for... c'mon.

      Are "C" or "Java" in any way descriptive or cute?

    8. Re:Why Rust by Anonymous Coward · · Score: 0

      Gnu Hurd?

      Or, for that matter, just GNU.

    9. Re:Why Rust by Anonymous Coward · · Score: 0

      To be fair, Terry Pratchett came up with the names Ogg and Vorbis.

    10. Re:Why Rust by Megol · · Score: 1

      C is the descendant of B (which in turn is based on BCPL (... CPL)). Java refers to the drinking habits of programmers (coffee...).
      So arguably C is descriptive and Java cute for some values of descriptive and cute.

  4. 1992 by Anonymous Coward · · Score: 0

    called. They want their macros back.

  5. The feature I really want by Anonymous Coward · · Score: 1

    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.

    1. Re:The feature I really want by Anonymous Coward · · Score: 0

      IDEs will do that if you declare a variable equal to the expression and then mouse over the variable name.

    2. Re:The feature I really want by DrXym · · Score: 1

      Use the Rust plugin for VS Code, or for IntelliJ / Clion and it will show you the inferred type.

    3. Re:The feature I really want by Anonymous Coward · · Score: 0

      IDEs will do that if you declare a variable equal to the expression and then mouse over the variable name.

      another trick is to intentionally cause a compiler error by trying to assign to the wrong type. The compiler error will then print the exact expected type.

    4. Re:The feature I really want by Phillip2 · · Score: 1

      Yep. The RLS is a little bit primitive that way and doesn't have this yet, I think.

    5. Re:The feature I really want by Anonymous Coward · · Score: 0

      I use vim and I don't really want to switch editor just to find the type of things.

    6. Re:The feature I really want by DrXym · · Score: 1

      Well don't use ctags or any other hinting a language or associated tool may provide and enjoy yourself. Not sure how your comment is relevant.

    7. Re:The feature I really want by Anonymous Coward · · Score: 0

      Use an IDE. e.g. CLion has a quick fix to specify the inferred type exactly. It transforms let foo = bar.xyz(); to let foo: SomeType = bar.xyz() with two keystrokes (alt+enter, enter)

  6. 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.

    1. Re:Can the devs do it themselves? by MarchHare · · Score: 1

      Woops. Replying ot myself. Just realized my code prints the filename and line number of the dbg!() method itself, not its caller. I shoudl have parsed caller[0] instead...

    2. Re:Can the devs do it themselves? by Phillip2 · · Score: 1

      It's relatively straight forward to implement. Rust has macros which are quite nicely integrated into the language.

      My experience of Rust macros is that you can do most things that you want with them, but you can't actually extend the language because they are not that flexible at matching syntax. It's not like lisp where you can't really tell whether you are using a language built-in or a macro.

      So, I think that you would find Ruby is more flexible as a language. But it's probably one of the reasons that Rust is very fast.

    3. Re:Can the devs do it themselves? by Anonymous Coward · · Score: 0

      I'm going out on a limb and saying that they just added this to the core lib.

    4. Re:Can the devs do it themselves? by Anonymous Coward · · Score: 0

      I tried to post the 11 line macro but I get a "Filter error: Please use fewer 'junk' characters.".

      You can find it here: https://github.com/rust-lang/rfcs/pull/2361

  7. Re:ANYTHING nazi crybabies have to whine about... by Anonymous Coward · · Score: 0

    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.

  8. Still not portable by Anonymous Coward · · Score: 0

    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.

  9. 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
  10. Re:Rust - the snowflake language by Phillip2 · · Score: 1

    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.

  11. Re:ANYTHING nazi crybabies have to whine about... by Anonymous Coward · · Score: 0

    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.

  12. Err.... gdb? by Anonymous Coward · · Score: 0

    I thought rust was a modern language. Why are we still debugging with print?

  13. 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.

    1. Re:No the "first credible attempt" by serviscope_minor · · Score: 1

      Yes good point, I completely forgot about D. D really takes metaprogramming top a whole new level compared to C++ (and rust). It's more than C++ without the warts. D was certainly credible and it's interesting why it didn't succeed.

      I think that one problem was that D wasn't created to solve a specific problem better than C++. It was designed to be C++ without the flaws, but maybe there was nothing where D was such a hugely definitive advantage that you had to use it. New languages have a big energy barrier. With rust at least, there was that one use case that C++ just couldn't do.

      D's metaprogramming is cool no doubt, but I guess we've seen work lisp that metaprogramming isn't enough to make a language actually work well for lots of people. D is certainly better than C++ on certain ways, but there's nothing quite definitive enough to overcome inertia.

      Plus D came about before the internet hype machine could really help it.

      --
      SJW n. One who posts facts.
  14. Re:Rust - the snowflake language by Tom · · Score: 1

    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
  15. A tough nerd by Anonymous Coward · · Score: 0

    I'm a nerd and interested in programming languages... And fuck anyone here who isn't

    A tough nerd. Now I've seen everything.