News for hackers. Stuff that matters.
Re:Copying data is wasteful, mutating data is dangerous by vmchale on Thursday January 09, 2020 @01:59PM (#22004277)
> I would dearly love to see a solution that allows me to code in a functional style without sacrificing performance.

Uniqueness types would make mutation easier to track: you'd still need to write an imperative style, but less to worry about.

I think the "functional-style" stuff in this area uses compilers (i.e. accelerate or futhark) that can analyze whether copying is necessary because the programmer uses various high-level functional combinators. I think J does something like this as well (?)

Re:Copying data is wasteful, mutating data is dangerous by Athas on Thursday January 09, 2020 @02:10PM (#22004375)
If you have precise reference counts (which is often achievable in array languages because they don't have cycles), then you can dynamically do efficient in-place updates if the array you are updating has a count of 1.

Uniqueness types are only necessary if you want to make the in-place update a static guarantee (which can be crucial if the code is going to run in an environment where allocation is not possible).