5 ms·
That said, I think Rust probably will need to improve on two fronts: 1) Better binding to C++ API 2) Compiling via MSVC on Windows. Windows is a bit of a red
by Ygg2 12y ago
That said, I think Rust probably will need to improve on two fronts:
1) Better binding to C++ API
2) Compiling via MSVC on Windows. Windows is a bit of a red headed step child for lots of projects and Rust won't have that luxury
- steveklabnik 12y ago#1 is very hard. D is the only language I know of that's reasonable about this, and even then, it's not everything. #2 is something we care about, and want to have the option to do in the future.
- fsloth 12y agoYou do realize that 1) can be non-trivial to achieve even if one is using C++ :)
- kibwen 12y agoImproving our Windows story will be an enormous priority post-1.0, as mentioned here: http://internals.rust-lang.org/t/priorities-after-1-0/1901 http://internals.rust-lang.org/t/priorities-after-1-0/1901 It's especially important as Mozilla intends to start shipping minor pieces of Rust code in Firefox this year, but Rust-based components will be relegated to nightly Firefox until Windows support improves. Here's a patch-in-progress for the first Rust code to be integrated into Firefox (Servo's URL parser): https://bugzilla.mozilla.org/show_bug.cgi?id=1151899 https://bugzilla.mozilla.org/show_bug.cgi?id=1151899
- ufo 12y agoI remember hearing somewhere that servo is focusing first on things that are nicer to do in Rust than in C++. Do you know if there is something that makes Rust more suitable for URL parsing than C++?
- jruderman 12y agoServo is trying to answer ambitious questions like "can layout be done as a sequence of top-down and bottom-up parallel tree traversals", "can we GC Rust DOM objects safely", and "how much of a browser engine has to be infected with support for non-UTF-8 strings". Gecko, on the other hand, will gain Rust in modules that can be changed without replacing the entire browser. I'm happy that one of the first will be the code that supports the URLUtils DOM API. When the C++ code was changed from being just "URL parsing" to supporting segment changes, it came to have way more than its fair share of memory safety bugs. It needs a rewrite and it might as well be in Rust.
- apaprocki 12y agoMicrosoft stepped up and contributed to Node/libuv to get those projects working well under Windows -- given the new leadership, I'd venture it would be in Rust's interests to reach out and see how willing they are to help. Maybe the result would be surprising :)
- duaneb 12y ago> Better binding to C++ API You realize that if this is perfect, you've basically implemented C++. It's easy to implement trivial bindings, but much beyond that requires an immense, immense effort and development.
- Ygg2 12y agoAnd that's why I said better. Perfect is the enemy of good (enough). I know both are areas of experiments in Rust. I think the intent is to use llvm to link(?!) C++ code in a format Rust can use.
- duaneb 12y ago> I think the intent is to use llvm to link(?!) C++ code in a format Rust can use. It's difficult to see this working except with trivial bits of code. For instance, how would you link to a type generated from a template with a string parameter? The most I can see is linking with an explicit subset of C++.
- malkia 12y agoCalling C++ from "ffi" is very hard. With "C" there is almost one to one mapping of the function you wrote to what the compiler produced and linker sees (there could be an "_" or more added, or something similar, but that's it). With C++ mangling (decorating) is specific per vendor, per compiler, and it might be even per compile options. Then you have different way of handling exceptions, new/delete, location of the this pointer, deep/shallow virtual tables, etc. etc. And for templates it's possibly very awkward to support them in any good way. It could be that wrappers like SWIG might help there, but would require some amount of work, or rewrapping the C++ interface to be "C" like with "objects". Some API/library writers go to the extent where even if the library is written in C++, a "C" interface is provided, and a new "C++" interface is written on top of the "C" (e.g. it's not using the original C++ one). This might be due to problems with dynamic (RTTI) symbols and different linkage versions (since you've asked about MSVC - different runtime libraries loaded in your application - yes this is pretty normal for Windows).
- istvan__ 12y agoHaving great C++ support is good for using libraries from the C++ ecosystem, I guess. This might help Rust to get traction, but there might be other features with more interest from the community that gets prioritized.
- MichaelGG 12y agoRe 2), my current fantasy is that Microsoft wakes up and gets behind Rust. Imagine having full VS support with Rust (not that Racer and vim are bad), and jump-starting tons of users to start writing _safe_ low-level code.
- kibwen 12y agoJust yesterday there was a new release of RustDT, a Rust IDE that works on Windows (http://users.rust-lang.org/t/rustdt-0-2-0-released-auto-complete-with-racer/1109 http://users.rust-lang.org/t/rustdt-0-2-0-released-auto-comp...) and at least one Windows user seems to be raving about how amazingly everything in it seems to Just Work (https://www.reddit.com/r/rust/comments/33p4oh/rustdt_ide_released_020_autocomplete_with_racer/cqne9wf https://www.reddit.com/r/rust/comments/33p4oh/rustdt_ide_rel...).
- MichaelGG 12y agoOh that looks fantastic. Eclipse based so I'm sure u can get a vim plugin too... You may have made me very happy.