Linked by Thom Holwerda on Wed 3rd Apr 2013 15:41 UTC
Mozilla & Gecko clones Big news from Mozilla and Samsung today: the two have been working on a new browsing engine together, developed from the ground-up to be completely new, and it's written entirely in Rust, a new safe systems language developed by Mozilla. "Rust, which today reached v0.6, has been in development for several years and is rapidly approaching stability. It is intended to fill many of the same niches that C++ has over the past decades, with efficient high-level, multi-paradigm abstractions, and offers precise control over hardware resources. But beyond that, it is safe by default, preventing entire classes of memory management errors that lead to crashes and security vulnerabilities. Rust also features lightweight concurrency primitives that make it easy for programmers to leverage the power of the many CPU cores available on current and future computing platforms." The work is on-going, but of course, all code is out there right now.
Thread beginning with comment 557461
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: this language is fugly
by Hiev on Wed 3rd Apr 2013 19:13 UTC in reply to "this language is fugly"
Hiev
Member since:
2005-09-27

Well smart ass, put the C++ equivalent and lets compare.

And what with these hipsters that see verbose as an insult?

Edited 2013-04-03 19:16 UTC

Reply Parent Score: 3

RE[2]: this language is fugly
by kwan_e on Thu 4th Apr 2013 00:14 in reply to "RE: this language is fugly"
kwan_e Member since:
2007-02-18

Well smart ass, put the C++ equivalent and lets compare.

And what with these hipsters that see verbose as an insult?


Actually, I think with C++11, you can write C++ in basically the same way as either of them with not that much more verbosity.

Reply Parent Score: 2

kristoph Member since:
2006-01-01

I don't think verbose is bad when the additional sytax provides implicit meaning. I think verbose is bad when it's just here because the language developer decided this extra stuff made sense to him.

Reply Parent Score: 2

RE[2]: this language is fugly
by kwan_e on Thu 4th Apr 2013 03:04 in reply to "RE: this language is fugly"
kwan_e Member since:
2007-02-18

Rust:

for ["Alice", "Bob", "Carol"].each |&name| {
..do spawn {
....let v = rand::Rng().shuffle([1, 2, 3]);
....for v.each |&num| {
......print(fmt!("%s says: '%d'\n", name, num))
....}
..}
}


C++ (tested in Cygwin with GCC 4.7.x):

for( auto name : { "Alice", "Bob", "Carol", "David", "Enid",
           "Fr an", "Gunther", "Harold", "Iris", "Jen" } )
{
  std::async( std::launch::async, [name]()
  {
    std::vector<int> numbers { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    std::random_shuffle( std::begin(numbers), std::end(numbers) );
    for( auto number : numbers )
    {
      std::cout << name << " says: " << number << std::endl;
    }
  });
}


Edited 2013-04-04 03:07 UTC

Reply Parent Score: 3

RE[3]: this language is fugly
by kwan_e on Thu 4th Apr 2013 04:57 in reply to "RE[2]: this language is fugly"
kwan_e Member since:
2007-02-18

Slightly more correct version in C++:

std::mutex cout_mutex;
std::vector<std::thread> threads;
for( auto name : { "Alice", "Bob", "Carol", "David", "Enid",
          "Fran", "Gunther", "Harold", "Iris", "Jen" } )
{
  threads.emplace_back(std::thread([name, &cout_mutex]()
  {
    std::vector<int> numbers { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    std::random_shuffle( std::begin(numbers), std::end(numbers) );
    for( auto number : numbers )
    {
      std::lock_guard<std::mutex> cout_guard(cout_mutex);
      std::cout << name << " says: " << number << std::endl;
    }
  }));
}

for( std::thread& func : threads )
{
  func.join();
}

Reply Parent Score: 2