Coder Social home page Coder Social logo

Comments (6)

nsajko avatar nsajko commented on June 20, 2024 1

Supporting Int only is okay/good b.c. that's what dims are represented

This is not a rule, e.g.:

julia> map(BigInt, 1:7)
1:7

julia> typeof(size(ans))
Tuple{BigInt}

from julia.

KristofferC avatar KristofferC commented on June 20, 2024

I want it to be public from base so folks don't have to re-implement it in packages.

Any examples of such implementations that folks had to reimplement?

from julia.

giordano avatar giordano commented on June 20, 2024

Any examples of such implementations that folks had to reimplement?

https://github.com/JuliaArrays/FixedSizeArrays.jl/blob/e1c3b345e60492ef057af3578d0f7a8a6ad99541/src/FixedSizeArrays.jl#L56-L82

from julia.

vtjnash avatar vtjnash commented on June 20, 2024

It also turned out to be occasionally useful just inside base, if you grep a bit (it is roughly equivalent to reduce(checked_mul, dims), but with special handling of zeros and typemax to correct some edge cases of those), so I think it is reasonable to export. I know FSA decided to implement it differently for themselves, though that will be necessary for packages that want to support older versions anyways.

from julia.

nsajko avatar nsajko commented on June 20, 2024

IMO it would be a bit weird to export Core.checked_dims, given that it's not generic and it's implementation is necessarily clumsy due to bootstrapping concerns.

FTR the function in FSA also supports just Int, but it would be easy to make it generic.

from julia.

LilithHafner avatar LilithHafner commented on June 20, 2024

Any examples of such implementations that folks had to reimplement?

https://github.com/LilithHafner/MallocArrays.jl/blob/0b6dbdc012e1058b2b64d0f94863eff4120def85/src/MallocArrays.jl#L10-L27


Yes, we'd need to make it a bit more generic and move it to Base. Possibly by defining Base.checked_dims(x...) = Core.checked_dims(Int.(x)...). Supporting Int only is okay/good b.c. that's what dims are represented/retrieved as, but auto-conversion is also reasonable.

from julia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.