Skip to content

Commit

Permalink
add experimental API's for broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Mar 26, 2019
1 parent 5291cbf commit 7e229e8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ include("util.jl")

include("asyncmap.jl")

# experimental API's
include("experimental.jl")

# deprecated functions
include("deprecated.jl")

Expand Down
33 changes: 33 additions & 0 deletions base/experimental.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

"""
Experimental
Types, methods, or macros defined in this module are experimental and subject
to change and will not have deprecations. Caveat emptor.
"""
module Experimental

struct Const{T,N} <: DenseArray{T,N}
a::Array{T,N}
end

Base.IndexStyle(::Type{<:Const}) = IndexLinear()
Base.size(C::Const) = size(C.a)
Base.axes(C::Const) = axes(C.a)
@eval Base.getindex(A::Const, i1::Int) =
(Base.@_inline_meta; Core.const_arrayref($(Expr(:boundscheck)), A.a, i1))
@eval Base.getindex(A::Const, i1::Int, i2::Int, I::Int...) =
(Base.@_inline_meta; Core.const_arrayref($(Expr(:boundscheck)), A.a, i1, i2, I...))

macro aliasscope(body)
sym = gensym()
esc(quote
$(Expr(:aliasscope))
$sym = $body
$(Expr(:popaliasscope))
$sym
end)
end

end

0 comments on commit 7e229e8

Please sign in to comment.