Skip to content

Commit

Permalink
Document the role of Ref in broadcasting. (JuliaLang#32645)
Browse files Browse the repository at this point in the history
* Document the role of Ref in broadcasting.

* replace with a more relevant example

* Update base/refpointer.jl

Co-Authored-By: Matt Bauman <[email protected]>
  • Loading branch information
tpapp and mbauman committed Aug 8, 2019
1 parent ad8cf8d commit 2edec09
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion base/refpointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ it can be written `Ref(a, i)` for creating a reference to the `i`-th element of
When passed as a `ccall` argument (either as a `Ptr` or `Ref` type), a `Ref` object will be
converted to a native pointer to the data it references.
There is no invalid (NULL) `Ref` in Julia, but a `C_NULL` instance of `Ptr` can be passed to a `ccall` Ref argument.
There is no invalid (NULL) `Ref` in Julia, but a `C_NULL` instance of `Ptr` can be passed to
a `ccall` Ref argument.
# Use in broadcasting
Broadcasting with `Ref(x)` treats `x` as a scalar:
```jldoctest
julia> isa.(Ref([1,2,3]), [Array, Dict, Int])
3-element BitArray{1}:
1
0
0
```
"""
Ref

Expand Down

0 comments on commit 2edec09

Please sign in to comment.