You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just wondering if anybody would be interested in the following macro @bkamins@markmbaum?
A function would be fine too of course; it just feels a bit more appropriate as a macro due to the behavior as both an operation on types and on instances.
macroreadonly(expr)
esc(:($(_readonly)($expr)))
end_readonly(::Type{A}) where {T,N,A<:AbstractArray{T,N}} = ReadOnlyArray{T,N,A}
_readonly(ar::AbstractArray) =ReadOnlyArray(ar)
Actually changed my mind... A readonly function is better than a macro. But I think an easy to use function for MyArrayType{T,N} -> ReadOnlyArray{T,N,MyArrayType{T,N}} would be a huge help for readability.
Just wondering if anybody would be interested in the following macro @bkamins @markmbaum?
A function would be fine too of course; it just feels a bit more appropriate as a macro due to the behavior as both an operation on types and on instances.
The use-cases are as follows:
I've got it as an internal macro but I could just upstream it here if interested.
The text was updated successfully, but these errors were encountered: