Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio...
by kstrauser on Wednesday October 01, 2025 @06:25PM
(#45444304)
There are any number of ways to skin that cat. In Rust, for example, values you pass, whether by value or by reference, are immutable by default. You have to explicitly mark them as mutable in the receiving function signature to allow mutation. I freaking love that as a default. Passing by reference is trivially easy, but you still avoid accidentally altering things that ought not be frobnicated.
[ Parent
| on HN ]
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio...
by davidschultz on Thursday October 02, 2025 @02:06PM
(#45453225)
In this case it might interest you to learn that in Raku (Perl 6), the values passed to a function are also by default immutable within that function.
If one wants the function to mutate them, one has to explicitly mark them as `$x is rw` in the function signature; this then requires one to always pass a mutable container for $x. (A bit more detail: https://andrewshitov.com/2019/10/15/110-is-rw-vs-is-raw-in-r... )