-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@SArray namespace hygiene #691
Comments
Yep this is a bug, thanks for the report. It's probably not too hard to fix, but I'm wishing we could remove these macros, or at least reduce their number (eg, removing With that in mind, what you think about the following alternative which was recently implemented in version 0.12? julia> using StaticArrays: SA_F64
julia> SA_F64[1,2]
2-element StaticArrays.SArray{Tuple{2},Float64,1,2} with indices SOneTo(2):
1.0
2.0 It's a syntax pun of course, though not particularly different from the existing |
Thanks for asking what I think. My first reaction is that I did not like that alternative, since it's not orthogonal. What if I wanted a But I see that you could do I wonder if there would be some generic code that assumes Are there other reasons you don't like the macro? |
Only if there's some unexpected way for julia> foo(T) = T[1,2] # This is typed array construction, right?
julia> foo(rand(2,2))
0.11408848854832776 # wait, what :-D We did discuss having an improved I don't think the macros will be going away any time soon, I think that would be quite unncessarily breaking for 1.0. But I'm still wondering about a viable transition plan for reducing the number of "constructor macros" and hoping people will be happy enough with the new syntax that we could go ahead with that eventually. |
Yes, right. But this is a pun on top of that pun, I'd think. You demonstrate that Base already breaks |
Indeed, it adds a third meaning to the syntax which could be regarded as a good or bad move, depending on how often you happen to be writing short However I can't think of a situation where |
The original issue was already solved. julia> using StaticArrays: @SArray
julia> @SArray Float32[1, 2]
2-element StaticArraysCore.SVector{2, Float32} with indices SOneTo(2):
1.0
2.0 |
gives
ERROR: UndefVarError: SArray not defined
indeed:
The definition
StaticArrays.jl/src/SArray.jl
Lines 82 to 235 in a3bca35
The text was updated successfully, but these errors were encountered: