enso/engine/runtime/src
Hubert Plociniczak ae0889e843
Make ArrayOverBuffer behave like an Array/Array.sort no longer mutates the Array (#4022)
Most of the problems with accessing `ArrayOverBuffer` have been resolved by using `CoerceArrayNode` (https://github.com/enso-org/enso/pull/3817). In `Array.sort` we still however specialized on Array which wasn't compatible with `ArrayOverBuffer`. Similarly sorting JS or Python arrays wouldn't work.

Added a specialization to `Array.sort` to deal with that case. A generic specialization (with `hasArrayElements`) not only handles `ArrayOverBuffer` but also polyglot arrays coming from JS or Python. We could have an additional specialization for `ArrayOverBuffer` only (removed in the last commit) that returns `ArrayOverBuffer` rather than `Array` although that adds additional complexity which so far is unnecessary.

Also fixed an example in `Array.enso` by providing a default argument.
2023-01-09 17:49:49 +00:00
..
bench Removing Unsafe.set_atom_field (#4023) 2023-01-09 13:39:14 +00:00
main Make ArrayOverBuffer behave like an Array/Array.sort no longer mutates the Array (#4022) 2023-01-09 17:49:49 +00:00
test Removing Unsafe.set_atom_field (#4023) 2023-01-09 13:39:14 +00:00