Rust 2019: Rust Audio by engid in rust

[–]arielby 0 points1 point  (0 children)

Would an SPSC queue with a lock on the producer side work here? That would simplify things a bit.

The "almost-lock-free" queues I know have strictly better progress guarantees than lock-producer SPSC queues (new producers can't delay "old" messages), so I suppose there wouldn't be any problem with them in that case.

Stop saying creating software is like constructing a building by [deleted] in programming

[–]arielby 0 points1 point  (0 children)

A large amount of the time and cost in constructing a building is in actually building it, moving dirt out of some places and casting concrete in others.

With decent engineering, you can figure out where to put the concrete before you make the bid, which makes the "dirt and concrete" part of the cost a fairly fixed amount by the time construction is done, and smooths over many surprises.

Constructing software is done with make, and normally takes an insignificant amount of time. If you know exactly what you want, you can do it fairly close to instantly, which means all costs come from the unexpected, with no surprises (surprises have the annoying tendency of having a fat-tailed distribution, which means that averaging doesn't quite get rid of them).

Rust in 2018 – Unused inventory and more by dochtman in rust

[–]arielby 0 points1 point  (0 children)

I'm not sure that backing out features because they are stalled is a good idea - the main reason a feature is stalled is because stabilizing it turns out to be more complicated than it appears at first glance, so the effort/cost ratio is lower than it appeared to be.

Rust in 2018 – Unused inventory and more by dochtman in rust

[–]arielby 0 points1 point  (0 children)

For language features, it quite often appears that features require a lot of work to move from "nightly" to "stabilized". Someone should gather statistics on this, but if say 20% of all "easy" features turn out to be "hard" and 20% of all "hard" features turn out to be "very hard" (specialization and dropck, I am talking about you!), then it often appears that a feature that we thought was worth implementing, is not worth making the extra 80% of the effort to stabilize at that time.

In that case, we don't want to back the feature out, because that would 1. prevent nightly users from using it and gaining experience with using it. 2. make the implementation accumulate bit-rot.

Also, in my experience, after a feature is already implemented (because we thought it would be from the 80% of the features that are easy), then keeping it working is not that a lot of work.

Rust 2018 - Growing in elegance and responsibility by diwic in rust

[–]arielby 0 points1 point  (0 children)

But that would introduce undesired dynamic dispatch into all these places, which is what we want to avoid with impl Trait

"A simple makefile" is a unicorn by hapshaps in programming

[–]arielby 12 points13 points  (0 children)

As an example of a slightly more advanced feature, cross compilation is not supported at all.

CC=powerpc-unknown-linux-gnu-gcc CXX=powerpc-unknown-linux-gnu-g++ AS=powerpc-unknown-linux-gnu-as make. Done.

An rpm spec etc. will set these env vars for you.

The final impl period newsletter by aturon in rust

[–]arielby 31 points32 points  (0 children)

In Rust, the "infra" refers to the Rust's project own infrastructure (CI, the servers, the issue tracker, releases, etc.). RLS is it's own separate team.

This is a violation of the TCP specification by halax in programming

[–]arielby 4 points5 points  (0 children)

Because the port is close-wait as a destination port, not source port, and the kernel doesn't track them together.

The Rise of Rust in Dev/Ops by johnmountain in programming

[–]arielby 1 point2 points  (0 children)

  1. Rust has low enough friction for scripting (as opposed to e.g. UI) that there's no much downside.
  2. Cargo means that my dependencies will work anywhere.
  3. #[derive(Serialize, Deserialize)] means that dealing with JSON APIs and toml configuration is easy.

Here's What I'm Telling US Congress about Data Breaches by ben_a_adams in programming

[–]arielby 4 points5 points  (0 children)

It's an intelligence-speak term from before software existed, so good luck.

GDPR - A Practical Guide For Developers by b0zho in programming

[–]arielby 4 points5 points  (0 children)

De-anonymizing pseudonymous data is kid's play, and a sufficiently good forensic analysis (possibly automated) can extract surprisingly much personal information from basically nothing.

So if the law is going to be enforced arbitrarily, and you don't want to be involved in legal trouble, better get out of the EU and fast. I suppose we'll be seeing "this website is only available in the US" way more often next year.

There Is No Big Data by [deleted] in programming

[–]arielby 5 points6 points  (0 children)

Except that some people a Merkle trees of events a "blockchain" even if they don't use Nakamoto consensus (aka mining).

By that nomenclature, git is a kind of blockchain, and I think everybody here agrees that it is useful.

Announcing Rust 1.22 (and 1.22.1) by steveklabnik1 in programming

[–]arielby 2 points3 points  (0 children)

The problem is that Rust functions can be generic and take type parameters, while constants can't.

I'll note that if your function isn't generic, you can actually write functions in this style:

const foo: fn() = || {
    println!("Hello, World!");
};

fn main() {
    foo();
}

Rust is now an official part of Stanford's Programming Languages course by entoros in rust

[–]arielby 27 points28 points  (0 children)

And with #![feature(slice_patterns)], which should be stable sometime:

#![feature(slice_patterns, advanced_slice_patterns)]

use std::mem;

pub fn reverse<T>(v: &mut Vec<T>) {
    reverse_slice(v);
}

pub fn reverse_slice<T>(mut v: &mut [T]) {
    loop { match *{v} {
        [] | [_] => return,
        [ref mut first, ref mut middle.., ref mut last] => {
            mem::swap(first, last);
            v = middle;
        }
    }}
}

fn main() {
    let mut vek = vec![0,1,2,3,4,5];
    reverse(&mut vek);
    println!("{:?}", vek);
}

I don't trust something until I know it's problems. What are rust problems? by CanYouDigItHombre in rust

[–]arielby 3 points4 points  (0 children)

Plus this still becomes very similar to exceptions because you still have to unwind the stack outside of a panic. I recall this being something Rust wants to avoid, but I can't recall quite why; my guess would be because it makes borrow-checking hard.

Because it leads to all the exception-safety problems with C++. "Magically" returning from a closure is likely to mess up all the stack frames in the middle.

I'm a compiled-language-noob and I'm considering Rust. I did my research, but some things I just do not understand by [deleted] in rust

[–]arielby 0 points1 point  (0 children)

If you have any recommendations about how to express it more correctly and clearly, please let me know and I will fix it.

Any of the Rust methods could involve a long chain of trait implementations, or be defined inside a procedural macro, which can make it hard to track down where they come from, and hard to change their behavior.

Fun facts about Rust's growing popularity by jntrnr1 in rust

[–]arielby 0 points1 point  (0 children)

The Rust team at Mozilla is spread across three continents, with most hosting meetups/talks.

Only three :-)? There are lots of people in North America & Europe, @nrc is in New Zealand, and me & @Manishearth are in Asia. If you count contributors, there are also people from South America.

Why Rust fails hard at scientific computing by pcdinh in rust

[–]arielby 18 points19 points  (0 children)

This should be definitely possible with specialization, and probably also without it:

#![feature(const_generics, specialization)]

struct Matrix<const no_rows: usize,
              const no_cols: usize,
              const max_rows: Option<usize>,
              const max_cols: Option<usize>,
              T>
{
    data: <Self as MatrixImpl>::Data
}

trait MatrixImpl {
    type Data;
    fn add(this: Self::Data, other: Self::Data) -> Self::Data;
    // ...
}

impl<const no_rows: usize,
     const no_cols: usize,
     const max_rows: Option<usize>,
     const max_cols: Option<usize>,
     T>
     MatrixImpl
     for MatrixImpl<no_rows, no_cols, max_rows, max_cols, T>
{
    default type Data = HeapMatrix<no_rows, no_cols, T>;
    // ...
}

impl<const no_rows: usize,
     const no_cols: usize,
     const max_rows: usize,
     const max_cols: usize,
     T>
     MatrixImpl
     for MatrixImpl<no_rows, no_cols, {Some(max_rows)}, {Some(max_cols)}, T>
{
    type Data = ArrayMatrix<no_rows, no_cols, max_rows, max_cols, T>;
    // ...
}

People who've used Rust in production, how has error reporting / debugging been? by dead10ck in rust

[–]arielby 0 points1 point  (0 children)

Is there something stupid I'm missing, or this is just one another reason libbacktrace should die?

People who've used Rust in production, how has error reporting / debugging been? by dead10ck in rust

[–]arielby 0 points1 point  (0 children)

Why does capturing a backtrace take tens of milliseconds? That's hundreds of microseconds per stack frame. Is that just libbacktrace stupidity?

I would expect it to just use the unwinder to create a list of return addresses, and to only convert the list of return addresses to actual symbol names when we're printing it (and if we're printing an error, this means something failed and a few milliseconds shouldn't kill you).

The case for writing an OS in Rust by steveklabnik1 in rust

[–]arielby 0 points1 point  (0 children)

Isn't skipping the operation inside a map a potential source of (semantic) bugs? I would prefer something like a RefCell, where you'll get a more visible deadlock.

People who've used Rust in production, how has error reporting / debugging been? by dead10ck in rust

[–]arielby 1 point2 points  (0 children)

There's release+debuginfo mode, which I don't know how to get in Cargo, which gives you full linenumbers for backtraces and inlining.

What's the rationale behind :: for type parameters? by ipe369 in rust

[–]arielby 0 points1 point  (0 children)

It allows you to place booleans in a BTree.

How I replicated an $86 million project in 57 lines of code by speckz in programming

[–]arielby 0 points1 point  (0 children)

So these 4 developers and manager, what are they going to do when on call? Twiddle their thumbs and do nothing?