Okay. I missed that definition for AbstractArray. Thanks for the clarification.
2014-12-08 9:51 GMT-05:00 Ivar Nesje <iva...@gmail.com>: > I don't think > > elsize{T}(::AbstractArray{T}) = sizeof(T) > > provides much in the sense of protection, but the *convert(Ptr{T}, x)* will > probably filter out AbstractArrays that isn't backed by a pointer. SubArray > implements its own pointer method, so we will probably get a MethodError > when we expect it. > > Ivar > > kl. 15:04:59 UTC+1 mandag 8. desember 2014 skrev Andreas Noack følgende: >> >> Ivar, I like that idea. It would make it easier to use pointers for >> arrays. Maybe there are caveats I haven't seen. >> >> Regarding AbstractArray, I think the call to elsize serves as a >> correctness check for that method. >> >> 2014-12-07 17:31 GMT-05:00 Ivar Nesje <iva...@gmail.com>: >> >>> Seems to me like pointer(A, 3, 6) would be nice and unambiguous for 2d >>> arrays. Is there any reason why that shouldn't be implemented? >>> >>> The current implementation is a little too dangerous for AbstractArray, >>> in my opinion. Can we limit it to ContiguousArray (or whatever it is called >>> now), and make it somewhat safer? >>> >>> https://github.com/JuliaLang/julia/blob/4b299c2fd5464ece308a8e708789a9 >>> d2aa9e32d3/base/pointer.jl#L29 >>> >>> I know these questions is a better fit for github, but I don't have time >>> to create a PR right now. >> >> >>