Skip to content

Commit

Permalink
narrow "ownership" conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
haberdashPI committed Oct 7, 2024
1 parent 8f7ef55 commit f8bbb61
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions base/iobuffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ It may take optional keyword arguments:
When `data` is not given, the buffer will be both readable and writable by default.
!!! warn "`data` is invalid after being passed to `IOBuffer`"
Once `data` is passed to `IOBuffer`, `IOBuffer` essentially "owns" this data, and existing
bindings to `data` should be considered invalid. There are no guarantees on its content at
this point. For example, `IOBuffer` may re-allocate the data as required, which may or may
not be visible in any outstanding bindings to `array`. There could be unallocated, arbitrary
values, nor can the ordering of any values written to this array be presumed.
Once `data` is passed to `IOBuffer`, if `write=true` (or `append=true`) and `maxsize >
length(data)`, `IOBuffer` essentially "owns" this data, and existing bindings to `data`
should be considered invalid. There are no guarantees on its content at this point. For
example, `IOBuffer` may re-allocate the data as required, which may or may not be visible in
any outstanding bindings to `array`. There could be unallocated, arbitrary values, nor can
the ordering of any values written to this array be presumed.
# Examples
```jldoctest
Expand Down

0 comments on commit f8bbb61

Please sign in to comment.