[rust-dev] Student projects/internships

David Bruant bruant.d at gmail.com
Fri Jan 13 10:39:04 PST 2012


Le 13/01/2012 17:04, mbrubeck a écrit :
> On 01/13/2012 07:11 AM, David Bruant wrote:
>> If it's the case, what about a C-to-Rust or C++-to-Rust compiler?
>> It would enable to leverage some existing code.
>> The Rust All Hands Winter 2011 presentation [1] say that some
>> components are planned to be written (slide 39). Such components
>> (parallel aspect aside) already exist in Gecko in C++. Having a
>> (partial) automation of the C++ to Rust transition would probably be
>> beneficial.
Recontextualising (other quote by me in this thread):
> The Rust All Hands Winter 2011 presentation slide 37 [3] shows a very
> ambitious project. I'm sure we agree that re-doing all this work from
> scratch while there already exists a C++ browser would be an error [1]
> [2].
> Consequently, a C++-to-Rust compiler seems to be a necessity to
> achieve the goal in slide 37, doesn't it?
>
> [1] http://www.slideshare.net/BrendanEich/msr-talk-7782102 slide 23
> [2] http://www.joelonsoftware.com/articles/fog0000000069.html
> [3] http://www.slideshare.net/pcwalton/rust-all-hands-winter-2011 

Le 13/01/2012 17:04, mbrubeck a écrit :
> Unlike JavaScript code, Rust code can link directly to C/C++ libraries
> (and vice-versa).  So you can already build programs that include both
> Rust and C++ code, without the performance hit of a source-to-source
> compiler.
Just to be sure I'm not misinterpreted, I'm not pretending that a
source-to-source compiler would be a final solution. The generated Rust
would need to be probably tweaked a bit to be production ready, both for
"serial performance" and also to make the program parallel if possible
and if easy enough based on the generated code.

I would consider a C++-to-Rust compiler only as an assistance tool, just
something that helps in the process, not a button you need to push once
and you're good to go.

> There's no need to translate existing code into Rust to leverage it;
> just use it directly, or write a small wrapper library.
It is my understanding that Rust is being designed also for the purpose
of being safer than C/C++ [4]. Tell me if I'm wrong, but if a component
is used as a library, it doesn't make it safer, yet, with privilege
escalation, it makes the program that uses it as a library potentially
vulnerable.

I agree that for purely the purpose of leveraging code, it is not
necessary to compile C++ to Rust, but to leverage code _and_ add the
safety (and maybe other properties, like easily make the program running
in a concurrent fashion), then compiling to Rust would be of a
tremendous help.

David

[4] http://www.slideshare.net/BrendanEich/future-tense-7782010 slides 14
to 20
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20120113/c9603b00/attachment.html>


More information about the Rust-dev mailing list