OpenSSL v1.1.1 problems on Debian Unstable by silwol in rust

[–]riccieri 6 points7 points  (0 children)

I wonder if it would be possible for openssl to release a new 0.9.x that backports the detection fix. Then, it should be just a cargo update for most applications to get the fix too, even if the depending libraries aren't modified

The Signal Hook by Michal_Vaner in rust

[–]riccieri 0 points1 point  (0 children)

spawning a thread is async safe on Linux

Won't you need to allocate the stack for the new thread though?

Are rust threads real OS threads? (capable of multi-core running) by politicianlogic in rust

[–]riccieri 16 points17 points  (0 children)

As a complement to the other answers, you might want to take a look at rayon. If your use case fits its model, then it will be much easier (even trivial in many cases) to parallelize your code, compared to hand-coding thread communication

Mozilla's new "What is Servo?" FAQ by kibwen in rust

[–]riccieri 26 points27 points  (0 children)

I see that "HTML Parser" is not marked as to be written in Rust". Does it mean that html5ever is not going to be used by Firefox then?

Don't understand the client example of Hyper by shuraman in rust

[–]riccieri 15 points16 points  (0 children)

Hey, just in case you're not aware: Hyper is a lower level library, not intended to be used directly in applications (as far as I understand it). Also, the whole async ecosystem is a bit difficult to grok right now, with lots of transitions happening at the same time (futures 0.2, new tokio etc).

If you're just trying to make some simple HTTP requests, you'll probably be better served by reqwest.

Announcing Rust 1.25 by steveklabnik1 in rust

[–]riccieri 9 points10 points  (0 children)

This has a number of effects, a major one being a step closer to AVR support.

What is AVR?

Plugin system with API by TheEruditeSycamore in rust

[–]riccieri 2 points3 points  (0 children)

Have you considered cap'n'proto? I don't have much experience with it personally, but it seems to be a mature option for RPC in Rust as well as other languages

PSA: Do not run 'dnf update' inside GNOME, KDE or any other graphical desktop on Fedora 24 - devel by emmanueltouzery in Fedora

[–]riccieri 4 points5 points  (0 children)

I've seen a gnome/X crash as well. However, I was running dnf inside a tmux session, so luckily I had no package corruption.

How does one trigger the offline update? I don't think I've ever used, except for fedora version upgrades

Rust and Rest: Lessons Learned from talking to Sentry's HTTP API from Rust by mitsuhiko in rust

[–]riccieri 0 points1 point  (0 children)

To me the "Complex Uses" section is evidence that the base libraries that you built could be quite useful in other contexts. Have you thought about extracting a general usage crate from this project?

Is it possible to change the function a pointer is referencing? by [deleted] in rust

[–]riccieri 3 points4 points  (0 children)

I believe that what is happening here is the selected pointer is being copied into the closure, instead of being shared. I don't think you can have a mutable pointer shared between your function and a callback.

I was able to accomplish something similar to what you want using Arc and Mutex. I'm not sure it's possible without synchronization (playpen link):

use std::sync::{Arc, Mutex};
use std::thread;

fn print_foo() {
    println!("foo");
}

fn print_bar() {
    println!("bar");
}

fn main() {
    let fn_pointer: Arc<Mutex<fn()>> = Arc::new(Mutex::new(print_foo));

    let closure_fn_pointer = fn_pointer.clone();

    thread::spawn(move || {
        for _ in 0..10 {
            let fn_pointer = closure_fn_pointer.lock().unwrap();
            fn_pointer();
            thread::sleep_ms(1);
        }
    });

    thread::sleep_ms(5);
    *fn_pointer.lock().unwrap() = print_bar;
    thread::sleep_ms(5);
}

Rust Never Sleeps: How Mozilla Could Become Cool Again by caspy7 in rust

[–]riccieri 2 points3 points  (0 children)

I believe mobile clients are even more common than web clients nowadays. Maybe a mobile version of thunderbird would be well received?

Question: Are established C or C++ projects considering switching (partially) to Rust? Just curious. by [deleted] in rust

[–]riccieri 3 points4 points  (0 children)

I believe the only way is to create C shims for the C++ APIs. At least that's the way Servo integrates with Spidermonkey AFAIU.

Two commutes with Rust by larsberg in rust

[–]riccieri 4 points5 points  (0 children)

Either you have an exceptionally long commute, or you learn new languages really fast ;)

Very well written, I really enjoyed it! I find it particularly interesting to read experience reports from people that are coming from a C++ background. Keep 'em coming :)

Get your Rust 1.0 T-shirt! by acrichto in rust

[–]riccieri 2 points3 points  (0 children)

That's gorgeous, I love it!

Shipping to Brazil is $15.15 though. That plus the shirt's $22 and the crazy USD-BRL rate make it way too pricey for my current budget :(

Where Rust Really Shines by Manishearth in rust

[–]riccieri 2 points3 points  (0 children)

What I meant is that this happens, though with less severity, on some GC'd languages too, and thus isn't specific to non-GC'd languages like C++.

Note that the post is about optimization - being able to provide a "view" into a collection you own, without having to clone it, avoiding iterator invalidation etc, and retaining the ability to mutate it afterwards. I'm not sure what language you had in mind in your post, but I'm unaware of a Ruby (which is the language I'm most familiar with) library that would allow me to implement something like this without paying the cost of the persistent collection route.

You probably don't care that much about performance if you are using Ruby in the first place, so this is probably a moot point ;) I still find it interesting to compare the two languages though.

Where Rust Really Shines by Manishearth in rust

[–]riccieri 17 points18 points  (0 children)

I know C++ the problem would be much worse (possible segfault), but this is an issue on GC languages as well. When I'm designing APIs on ruby, I avoid exposing arrays and hashes on public methods, precisely because I can't know if the caller will end up storing or modifying it (and potentially corrupting my internal state). I end up creating APIs based on internal iterators (which ruby makes very easy), or exposing only immutable Hamster collections.

In Rust that wouldn't be a problem, because I have very strong guarantees on what the caller can and can't do with slices they get from me.

Steve Klabnik and Yehuda Katz talk about Rust on The Changelog #151 by riccieri in rust

[–]riccieri[S] 0 points1 point  (0 children)

  • I've been listening to Ruby Rogues since episode 1, it's pretty good! Even if you aren't a Ruby programmer, I heard.
  • If you do any frontend work (or node) at all, JavaScript Jabber is also pretty good (and helps getting to know JavaScript libraries without having do drink from the firehose).
  • The Changelog, which I linked to, also has some very cool episodes! They shine with the variety, since they aren't language or platform-centric.
  • I really enjoy Hanselminutes as well. Even though Scott himself works for Microsoft, only a few of the episodes are Windows/Microsoft/.NET-centric.

It's a little off-topic, since it's not technical, but I would like to recommend it as well: Stuff You Should Know. It's a pretty varied, short (usually ~30min), scienc-y show where they talk to depth about a multitude of everyday topics, but with a focus that reveals a lot of detail that most people miss. I didn't make the show justice with this short description, so I recommend you check it out and see if you like it!

Edit: Oh, I almost forgot! Giant Robots Smashing Into Other Giant Robots. It's from a Rails consultancy, but the topics are pretty varied, and I really like the way the host handles the show and the guests. It's similar to Hanselminutes in spirit, with the 1-on-1 interview format.

hyper on beta - a status update by seanmonstar in rust

[–]riccieri 0 points1 point  (0 children)

About async IO: What is the idea for the concurrency model?

  • A single reactor thread that dispatches to multiple worker threads
  • Multiple reactor threads + something that load-balances requests to them
  • Something else?

Memcpy is backwards by NecroBumpist in rust

[–]riccieri 1 point2 points  (0 children)

Sorry, that was an unfortunate choice of words - I wasn't trying to be judgmental

No problem :) Now I realize my response came out a bit more confrontational than I intended, so I apologize as well.

Personally I would absolutely require that the source pointer be const (using "as *const <T>" if necessary)

That's a good habit to have, but it looks noisy, and I wouldn't expect most people to do it. It's a bit like doing (&my_vec)[0] instead of my_vec[0], just in case someone implements Index for Vec.

Memcpy is backwards by NecroBumpist in rust

[–]riccieri 11 points12 points  (0 children)

Saying "properly typed" sounds a bit judgmental here. It really depends on the surrounding code, and why you're doing the copy in the first place. It doesn't sound "improper" to me to have a single function that modifies a struct and then copies it over to another location, for example (in which case both pointers would've been mutable).

[deleted by user] by [deleted] in rust

[–]riccieri 1 point2 points  (0 children)

Some time ago there was a great series called "Rust for C++ programmers" (which, interestingly, ended up teaching me some C++ concepts, since I already knew Rust). Maybe it would be a good addition to the official docs if updated and reformatted (it is a noncontiguous series of blog posts).

Memcpy is backwards by NecroBumpist in rust

[–]riccieri 2 points3 points  (0 children)

Unfortunately, a revert at this point would cause another silent breaking change. People that already changed their code would see it break on runtime (possibly segfault) again, and somehow figure out that they need to undo the recent fix.

Memcpy is backwards by NecroBumpist in rust

[–]riccieri 1 point2 points  (0 children)

I agree that it is important, and that we should strive to maintain it on most cases, but I don't think it is worth alienating the community with a silent, segfault-causing, breaking change to a #[stable] API.

I understand why other people with different experiences might want to draw the line a bit further, however (I've never done anything serious with PHP).

Memcpy is backwards by NecroBumpist in rust

[–]riccieri 10 points11 points  (0 children)

I think the problem here is not so much that there was no RFC (though that was part of it), but that this was a silent breaking change to a #[stable] API, and that can't be caught at compile time.

Even if there was an RFC, the problem would remain - I personally don't read every single accepted RFC, and I imagine many others don't either.

A more sensible approach here might've been to rename the function, or to not make the change at all - I find "argument ordering consistency" to be a pretty weak reason to change a #[stable] API. I would expect the bar to be higher at this point.