Skip to content
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

Order of definition matters for splatting functions #5536

Closed
timholy opened this issue Jan 25, 2014 · 1 comment
Closed

Order of definition matters for splatting functions #5536

timholy opened this issue Jan 25, 2014 · 1 comment
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@timholy
Copy link
Member

timholy commented Jan 25, 2014

function test(a::Union(Real, AbstractArray)...)
  println("Splatting")
end
function test(a::Union(Real, AbstractArray))
  println("Non-splatting")
end
julia> test(5)
Splatting

If you switch the order of definition, it calls the non-splatting version.

@ghost ghost assigned JeffBezanson Jan 28, 2014
timholy referenced this issue Feb 3, 2014
* Use setindex_shape_check and DimensionMismatch instead
  of generic errors; this (and a couple of extra minor fixes)
  makes BitArrays behave like Arrays (again)
* Move portions of the indexing code to multidimensional.jl
* Restrict signatures so as to avoid to_index and convert, then
  create very generic methods which do the conversion and the
  dispatch: this greatly simplifies the logic and removes most
  of the need for disambiguation. Should also improve code
  generation.
@timholy
Copy link
Member Author

timholy commented Mar 9, 2014

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants