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.
They are targetting ARM and Android. Only.
Well, for now, it doesn´t say that it in the end will be exclusive to ARM and android.
Yes, but this kind of prioritization is rather new*, I think, and worth a mention.
*for a new langage and a basic** piece of software such as a web engine.
**”basic” as in “common, standard, usual”, not as in “simple”.
And yet, it’s still interesting.
Why is it interesting? It’s interesting because they’re not resting on their laurels. It’s interesting because they’re not only not ceding to the WebKit mono-culture, they’re expanding beyond Gecko itself, and, ideally, taking all that they have learned in the past several years to a new engine.
Perhaps the ARM environment was different enough to make a new engine worth exploring vs simply porting and tweaking Gecko. It also acts as a solid use case for their new language, so it’s a win win.
It’s a win win even if it doesn’t pan out, for whatever reason. Consider it basic research.
So, yea, interesting. Exciting. A mature industry and still doing the hard work and moving forward. Good for them.
I agree. I find both the browsing engine and Rust to be interesting for the same reasons.
I’m reserving judgement until I do more research, but I like the ideas behind both. Like you, I appreciate the basic research as much as anything that comes from it.
Sure maybe the push is to target ARM, but I just built it and ran the simple about-mozilla.html on Linux. It crashed upon loading OSnews, or else I would have submitted this response with Servo. I doubt they would hamper it in any way to prevent running anywhere else.
Both Servo and Rust are mainly developed on x86. What Samsung is bringing to table is helping with ARM support.
Why is C++ like having sex on a cruise ship? Because it’s fucking close to C.
—————-
Anyway, visited the Rust website. Read the stuff. For a moment I thought I was reading the C++11 standard. The “C++” that gets mentioned as a contrast to Rust doesn’t resemble any C++ that I know of, other than C++ written in a Java style.
Diamond inheritance keeps getting mentioned as a problem when in fact inheritance isn’t even that useful in C++ in the first place.
Have you ever done enterprise C or C++?
Guess where most J2EE architects used to program before.
But did they program in the same style? Did they program Java SE as well and picked up the bad habits from there? The fact that they moved from C++ the J2EE suggests that they found C/C++ not very amenable to the Java style.
In the world days enterprise computing was full of SUN/DCE RPC and eventually CORBA distributed applications.
Everything placed nicely in tons of abstraction layers.
The initial versions of J2EE are not much different from enterprise architectures that were CORBA based with C or C++ implementations.
Actually Java felt like godsend because it made it way much easier to explorer the type of OO designs already being made in C++, but they were full of issues caused by compatibility between C and C++ compilers across multiple operating systems.
Yes, but that’s RPC and CORBA. Especially CORBA being designed by the same design pattern happy committee.
And mainly used in the C++ land.
And, aside from using the CORBA mappings, you don’t need to continue the madness and transparently write in a non-Java style.
If we are going to blame C++ for allowing Java style problems, then I see no way in which Rust would prevent the exact same thing from happening.
Let’s have proper, thought out, comparisons.
If you don’t think inheritance is very useful in C++ in the first place, then my guess is that you really don’t understand it.
Now I’m not a big fan of multiple inheritance – or rather using it in ways that lead to the Diamond Inheritance problem – but I have found inheritance to be very useful in C++.
I wonder, are you people aware of the (at least theoretical) difference between subtyping and inheritance? Because knowing that helps with a lot of problems (well, it helps preventing broken APIs).
Inheritance isn’t as useful in C++ as it is in Java or other languages without good compile time generics support. When inheritance is used in C++, there’s often no need for overblown class hierarchies that makes diamond inheritance more likely.
I’ve programmed C++ before. It can be difficult with all the inheritance stuff, but the best part is you can have sex on a cruise ship when needed.
Rust
Ruby (as an example)
Why make a modern language so verbose and distasteful.
Edited 2013-04-03 17:29 UTC
Does that matter? Genuine question – I’m no programmer – but isn’t its functionality and benefits more important than how it looks?
If you can reach everything you need to in a room, and its not got mold, lice, cockroaches or rats, then any further cleanliness is theoretically pointless. And yet, for some reason, a clear room makes for a clear mind.
So strictly speaking no, it doesn’t matter, except that it makes it easier to type quickly and understand when reading, which you’ll get the hang of in time in any case. But in our minds a clean aesthetic to the language implies a clean aesthetic to the architecture and methods. That’s quite important, especially when a programmer spends more time staring at the text file than the actual resultant program.
Readability, expressability, logical conistency, avoiding ambiguity, synactic ease .. are all incredibly important.
You can do all you want with assessmbly language but you wouldn’t.
Human considerations of readability and understandability by someone who wasn’t the original author is really really important when doing anything above a certain human scale.
And even if it was a small human scale – ie just you coding – the ability to easily translate human ideas into code .. and back… is really key.
Python was popular for minimising the leap between human mind and code… other languages are great for supreme consistency and architectural logic.
Generally yes. Readability is important, since most of your day is spent reading code rather than writing it (Today I maybe spent a solid 30 minutes writing code out of my 9 hour shift).
Ruby and the Rust Syntax demonstrated has some familiarities with Visual Basic. Most programmers hate Visual Basic mainly due to its syntax and partly because a lot of awful code is written in it.
I find that Syntax hard to read especially since the characters in both examples mean completely different things in C like languages, VB and Python (not sure about others).
Readability, understandability, with all these clean code, I can’t understand why most posts here don’t mentioned Ada or Pascal?
<rant>
Because hipster kids don’t known them and think only C and C++ have compilers available to them.
</rant>
Name one popular modern language runtime or framework that uses them?
Not really, otherwise we would all be using Lisp..
Then again C++ syntax is not that good either..
It’s not looks so much as code readability. If you want to bring in new contributors eventually, you want your code to be as readable as possible with as little effort as possible especially when you’re dealing with something as complex as a web rendering engine. A language can look like crap so long as it’s readable but, if it’s stuffed full of unnecessary syntactic elements as Rust is, it’s counter-productive. It takes longer to read, longer to review, longer to code, and introduces a much greater chance for mis-typing a punctuation mark that really shouldn’t be needed. The code snippet at the start of this thread is a perfect example: what in hell do you need with all those | and & signs when there are much simpler ways to express that concept? I shouldn’t be surprised though. This is Mozilla at work, and these are probably the same people that thought the bloated beast known as XUL was a good idea for a cross-platform UI toolkit.
Yeah, like ruby is so much more readable and concise lol
I’d agree. They’re both kind of fugly. If I had to choose, I’d probably prefer the rust syntax. Plus its supposed to be lower level, which is nice. But, I’m not in too big of a hurry to adopt a language that’s “rapidly approaching stability”.
Your really missing the point. Ruby may not be your cup of tea but it’s syntactically consistent. Just read that Rust example …
– what is the value of ‘let’; obviously the compiler can implicitly identify new variables (notice there is no type declaration)
– why pair for and each, don’t both implicitly mean the same thing (they do in most languages)
– why do I need to put do in front of a spawn which takes a closure as it’s param (there is no good reason, it’s just how they decided it should be)
If you try to learn Rust you’ll see it’s full of these dumb arbitrary decisions. It’s like French and masculine and feminine verbs. There are some rules and then there is stuff that just is. French has an excuse, it’s developed over thousands of years, a modern computer language should be better thought out.
In my opinion, the worse part is the mix between object orientation and functional approach (like in python):
for [“Alice”, “Bob”, “Carol”].each |&name|
let v = rand::Rng().shuffle([1, 2, 3]);
It should either be
for name in [“Alice”, “Bob”, “Carol”
let v = rand::Rng().shuffle([1, 2, 3]);
or
for [“Alice”, “Bob”, “Carol”].each |&name|
let v = [1, 2, 3].shuffle();
but missing both approaches is just confusing. This kind of design flaw was tolerable in the 80s, but if you are designing a new programming language in 2013, you should stick to one paradigm.
Not to get too of topic, nor to defend french, but in my experience (6-10 spoken languages investigated,) english is the only language I’ve encountered without the strong gender emphasis.
Also, most of the gender emphasis is actually object concepts (nouns and adjectives.)
I know that I am being a bit silly by pointing this out, but it is because there are some languages out there that can import foreign words properly, as they break the gender emphasis and then can’t be used properly (declinated or conjugated.)
Chinese and Japanese have no genders for words.
Neither does Hungarian or Finnish. According to the Wikipedia, only about one fourth of the world’s languages use grammatical genders*. It’s more of an indoeuropean / semitic thing.
* Though it is well possible that, apart from the ones mentioned by us, the biggest languages fall into this category.
Well, Rust is at 0.6 and the syntax is at a rapidly evolving stage. So feel free to get involved if you are motivated enough to do something concrete.
Personally, I don’t see how the Ruby syntax is going to be more appealing to C++ programmers which is the target of Mozilla.
Personally I don’t see how the rust syntax is going to be appealing to C++ programmers. Especially since Rust is meant as a replacement of C++, while Ruby is not. Personally, I use C++ and Ruby, but for different purposes, and I wouldn’t use C++ for what I do in Ruby (ie scripting, prototyping) or Ruby for C++. Different purposes, different syntax.
Now why rust is not appealing for C++ developers (at least me), it is needlessly different from C++.
Rust: fn recursive_factorial(n: int) -> int
C++: int recursive_factorial(int n)
Rust: for(somevector.each |&name|)
C++: for(auto name : somevector)
And so on. Meaning that a C++ developers would have to anyway learn a new programming language.
It is true that having a new syntax is not necessarily a bad idea, however, from looking at the rust examples it looks as quirky as C++, but in different ways. So why jump ship from C++ to Rust if it is not for improvements ?
Agreed, in the languages I know there is either
for <iterator name> in <set> do <code>
or
<set>.each |<iterator name>| { <code> }
But Rust use both for and each??
Also in Rust { a * x + b } is different from { a * x + b; }, the first one returns a value, the second one returns (), nice heh?
No!!! If they find return too verbose why didn’t they use the ‘^’ operator as Smalltalk did?
I’m not sure that the use of ‘,’ to separate case in the ‘match’ statement is a good idea either..
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
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.
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.
Rust:
C++ (tested in Cygwin with GCC 4.7.x):
Edited 2013-04-04 03:07 UTC
Slightly more correct version in C++:
Seriously? _One_ example. A comparison to _one_ other programming language. And the difference is _one_ more line of code. And you discard the entire language as “verbose” and “distasteful”? I haven’t even read about the language yet, but that’s just ridiculous.
I don’t understand why people use that Ruby syntax. I think this is better (more concise, less of a finger twister on German keyboards and more readable):
But then I also think that one of Rubys biggest problems is it’s redundancies (in syntax and interfaces). It causes strange syntax errors (the crappy parser errors aren’t any help either) and lower readability/consistency (one team member uses variant A, the other variant B – then they have to read and understand each other’s code).
I like the philosophy behind Python much much more, even though a way to inline declare and pass a multiline anonymous function to another function would be nice (-> Ruby’s blocks). But many things for which blocks are used in Ruby can be done with the with statement in Python and Python’s generators are more powerful than anything in Ruby.
I was not really making a comment about the benefit/advantage of Ruby. I was just pointing out that it was much cleaner syntactically. Python is fine too (and even less verbose). Heck, even Objective C is nicer then Rust to my eye.
All I am saying is if your trying to build a new language make it VERY readable, do away with addition keywords and constructs that don’t add tangible meaning, try to maintain consistency in syntax and not require arbitrary ‘grammar’ or abbreviations.
Rust is a static, safety-oriented language targeted at the same niche as C++. It’s a genuine achievement to have the Rust example demonstrate the same level of expressivity as the Ruby version.
Of course there’s still too much special syntax in both versions. 🙂
#lang typed/racket
(for ((name ‘(“Alice” “Bob” “Carol”)))
  (thread
   (thunk
    (for ((number (shuffle ‘(1 2 3))))
      (printf “~a says ~a\n” name number)))))
Edited 2013-04-03 20:47 UTC
There are static compiled versions of Ruby.
Check Crystal,
https://github.com/manastech/crystal
Rust has to support much more stuff than Ruby; it has 3 pointer types for starters, IIRC.
Rust does ok IMO, considering the complexity of concepts it needs a way to express (dynamically typed languages without pointers get off easier in comparison).
As someone who’s done embedded programming, I love Rust. So I’m really resisting the urge to say something nasty about your upbringing.
Ruby and Rust are completely different beasts. Rust is completely interoperable with C, and could conceivably be used in writing an operating system, or OS-level code. You’d have to compare it to something like Go as opposed to Ruby, and even Go would be considered higher level.
Considering where it sits on the spectrum of where you can execute Rust, the language is nicer than anything you could come up with.
And Ruby is a bloated, slow and awful language and you’re a terrible person and I hope everyone gets cupcakes except you.
An engine called ‘servo’, built on ‘rust’. Somehow, that doesn’t sound very appealing, nor does it sound safe.
Joking aside,
First the carriers (to spread Firefox OS) and now Samsung. That’s like contracting syphilis from one hooker and then getting HIV from another for good measure. Way to go, Mozilla.