Conversation

Jarkko Sakkinen

Edited 8 months ago

For small real-time #audio thing i’m working for my own entertainment i stick to good old #C and #PortAudio.

Working on Rust would mostly getting into unsafe mode and cursing that there is no “first-class” way to check each and every dynamic memory allocation success. Finally, the audio libraries are quite bad when considering ones actually implemented with Rust (e.g. CPAL), not just bindings to e..g PortAudio.

So where I would not like to Rust bother, it would come to poke me with. a stick, and where I would need its help, it totally ignores the issue.

I’d like Rust more if people would stop describing it as a memory safe language.There is no such thing as memory safe language. There’s only languages with weaker and stronger checks/guarantees, and usually only for a subset of overall memory management.

In the case of Rust it can handle dangling references but ignores memory usage and out-of-memory conditions completely.

#rustlang

2
0
0

@jarkko do you not consider the `try_new` API first class?

https://doc.rust-lang.org/std/boxed/struct.Box.html#method.try_new

I know the allocator API is not stable yet, but that's because Rust strives to be designed with care, and I understand it's frustrating not having must have features.

I could name a few, but I'm sure you understand what I'm saying.

1
0
1
@diegovsky I would (and will) when I have a chance definitely give it a shot. I'm aware of this in nightly but really have to have a legit workload to make any further arguments. Fair point anyway :-) I really do hope that things improve and my position changes...
1
0
1
@diegovsky ,,, next time I have chance to do something with Rust at work. During leisure one should do only stuff that you already enjoy :-)

Also the audio library rant is not really Rust issue. The current libraries just have decade or two maturity gap to catch up...
1
0
1

@jarkko That's a fair point about leisure, though I love writing rust in general :)

Btw, I'm interested to know: why do you think libraries are 2 decades missing in experience?

1
0
1
@diegovsky Right, I do not mean that it would take 2 decades for pure Rust libraries to catch up but more like PortAudio was pretty mature already in 00's (used by Audacity, quite a few game titles etc.) so it will take a lot to catch it up.
2
0
1
@diegovsky anyway, thanks for asking, it would be quite obnoxious to claim that for Rust it would take 2 decades to catch up...
0
0
1

@jarkko Ah, that wasn't what I meant either :)

I meant to ask which kind of improvement audio libraries in general are missing compared to PortAudio, for example.

You have answered my question regardless, so thank you :)

1
0
1
@diegovsky I check also Vec and it also has try_reserve(), which I suppose gives similar tool as for Box to check the success state.

I think these are a big improvement but I hope that clippy will also get flags to emit error if every allocation in a code-base does not have the heap checks.
0
0
0