Thomas ten Cate
Thomas ten Cate
That's what I thought. Why is there a non-expression `switch` statement anyway? `1; 2; 3;` is a valid Rhai program, so clearly expressions can be statements too.
It parses as a statement even inside an `if` _expression_: ``` let x = if true { switch 1 {} * switch 2 {} } ^ Unexpected '*' ```
I'm using https://rhai.rs/book/engine/expressions.html. Edit: actually, I'm not using that anymore because for some reason it disallows `if` and `switch` _expressions_, but my primary purpose is still to evaluate expressions.
I'm running some Rhai code to compute some value from some inputs. It's intended to be a pure function. I'm exposing no functions to the engine that have side effects,...
That's okay. Since a statement block also evaluates to the last statement, I can just use that. It also helps with more complex expressions, e.g. if the user wants to...
I can see how loops would open you up to DoS attacks if you are running this as e.g. a web service. But `if` and `switch` expressions can't be used...
The `MaybeUninit::as_mut_ptr` documentation currently warns: > Reading from this pointer or turning it into a reference is undefined behavior unless the `MaybeUninit` is initialized. I suppose this applies to `slice_as_mut_ptr`...
This is a legitimate issue; I've noticed it on my laptop as well. The problem is with the continuous rendering of the canvas element that draws the real-time spectrogram at...
> Couldn't you stop the visualization automatically after (attack+sustain+decay) seconds? There's a falloff after that, as it does some sort of IIR sliding average, but in principle, yes. I just...
It's definitely the visualizer, because the high CPU disappears as soon as you turn it off. Indeed render time for the sound effect itself isn't a huge problem. Longer sound...