Skip to content

Commit 2427d47

Browse files
committed
Add note on tracing that may make implementing out= impossible.
1 parent 9153f06 commit 2427d47

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

spec/design_topics/copies_views_and_mutation.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ The situation with `out=` is slightly different - it's less heavily used, and
5757
easier to avoid. It's also not an optimal API, because it mixes an
5858
"efficiency of implementation" consideration ("you're allowed to do this
5959
inplace") with the semantics of a function ("the output _must_ be placed into
60-
this array). There's alternatives, for example the donated arguments in JAX
61-
or working buffers in LAPACK, that allow the user to express "you _may_
62-
overwrite this data, do whatever is fastest". Given that those alternatives
63-
aren't widely used in array libraries today, this API standard chooses to (a)
64-
leave out `out=`, and (b) not specify another method of reusing arrays that
65-
are no longer needed as buffers.
60+
this array). There are libraries that do some form of tracing or abstract
61+
interpretation over a language that does not support mutation (to make
62+
analysis easier); in those cases implementing `out=` with correct handling of
63+
views may even be impossible to do. There's alternatives, for example the
64+
donated arguments in JAX or working buffers in LAPACK, that allow the user to
65+
express "you _may_ overwrite this data, do whatever is fastest". Given that
66+
those alternatives aren't widely used in array libraries today, this API
67+
standard chooses to (a) leave out `out=`, and (b) not specify another method
68+
of reusing arrays that are no longer needed as buffers.
6669

6770
This leaves the problem of the initial example - with this API standard it
6871
remains possible to write code that will not work the same for all array

0 commit comments

Comments
 (0)