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

deprecate concatenating [...] #7998

Closed
wants to merge 2 commits into from
Closed

deprecate concatenating [...] #7998

wants to merge 2 commits into from

Conversation

nolta
Copy link
Member

@nolta nolta commented Aug 13, 2014

julia> [1:2, 3]
WARNING: [a,b] concatenation is deprecated; use [a;b] instead
3-element Array{Int64,1}:
 1
 2
 3

julia> [1:2]
WARNING: [a] concatenation is deprecated; use [a;] instead
2-element Array{Int64,1}:
 1
 2

ref #2488, #3737, #7941

@kmsquire
Copy link
Member

+1.

Perhaps suggest [a...] for the second case?

On Wed, Aug 13, 2014 at 2:35 PM, Mike Nolta notifications@github.com
wrote:

julia> [1:2, 3]WARNING: [a,b] concatenation is deprecated; use [a;b] instead3-element Array{Int64,1}: 1 2 3
julia> [1:2]WARNING: [a] concatenation is deprecated; use [a;] instead2-element Array{Int64,1}: 1 2

ref #2488 #2488, #3737
#3737, #7941

#7941

You can merge this Pull Request by running

git pull https://github.com/JuliaLang/julia mn/sanecat

Or view, comment on, or merge it at:

#7998
Commit Summary

  • make vcats explicit
  • deprecate concatenating [a,b,...] and T[a,b,...]

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#7998.

@StefanKarpinski
Copy link
Member

I really just want a different operator altogether for array concatenation. Not sure what though.

@JeffBezanson
Copy link
Member

If {} used its arguments to determine the array element type, it would make sense for [] to be concatenating and {} not. Or the other way around, though that's a more dramatic change.

Another advantage of switching them ({} concatenates, [] doesn't) is that both T[...] and [...] would just be "vector constructors". T{...} is taken by types, but that's ok because specifying an element type for the result of a concatenation is a bit odd and doesn't seem to be needed in practice.

@kmsquire
Copy link
Member

+1 to using {} for concatenation... although that is a very breaking change, since that is one of the few ways to avoid concatenation right now. ;-/

@ViralBShah
Copy link
Member

+1 for this change. I really would not want to break the concatenation operator.

@JeffBezanson
Copy link
Member

Something that's not satisfying here is that if you want [a b;c d], but have it not concatenate, you have to use {a b; c d} (which could be changed to use an element type other than Any). This then becomes the only use for {}, which seems like a bit of a waste.

We would be better off having one always concatenate, and the other never. Or add something like Stefan's |a b| proposal, and reclaim {} for something else.

@nolta nolta closed this Aug 20, 2014
@nolta nolta deleted the mn/sanecat branch May 8, 2015 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants