WIP: Make [a, b] non-concatenating#8599
Conversation
3c19bd0 to
c4b81f4
Compare
Conflicts: base/LineEdit.jl base/show.jl src/julia-parser.scm test/collections.jl
|
Awesome! Fixed my conflicts. |
|
+1 |
|
Looks like this also fixes #8541? |
|
This parses |
|
Although really the problem is that |
|
Maybe we should get rid of "typed cat" syntax as well. I wonder how much it is used? |
|
Almost never (scanning over all registered packages): /Users/jacobbolewski/.julia/v0.3/MathProgBase/test/mixintprog.jl => 1
/Users/jacobbolewski/.julia/v0.3/TimeData/test/dataframe_extensions.jl => 2
/Users/jacobbolewski/.julia/v0.3/DataArrays/test/literals.jl => 4
/Users/jacobbolewski/Julia/julia/test/reduce.jl => 3
/Users/jacobbolewski/.julia/v0.3/MAT/test/read.jl => 1
/Users/jacobbolewski/Julia/julia/test/arrayops.jl => 1 |
|
In the MathProgBase test, we use "typed cat" to make a Float64 matrix from Int literals: Float64[1 2 3 4 5]So it's kind of a corner case (and not strictly necessary), but the syntax is nice for it. |
|
It wouldn't be much of a loss to have to change that particular case to |
|
That syntax just doesn't quite seem general enough to be worth it. |
|
I think I agree, but it's not clear to me why it would potentially be removed either. Just to avoid the ambiguity in parsing |
|
While we're making breaking changes here anyway, I think we really should |
|
My hatred of this array syntax does grow. Some non-obvious behaviors: x = 1:10
....hundred lines later....
y = [x;] # what the hell does this do?# lets play spot the semicolon....
for Mi7647 in {Symmetric(diagm(1.0:3.0)), Hermitian(diagm(1.0:3.0)),
Hermitian(diagm(complex(1.0:3.0))), SymTridiagonal([1.0:3.0;], zeros(2))}
...# unrelated but another unreadable example
[3 3 + 4im 4 + 5im 6im 7 + 8im 4 + 3im 9 4im]There seems to be a tension between wanting concise syntax, wanting syntax that allows you to sanely overload getindex |
|
We should consider getting rid of the space-separated syntax in side of array literals while we're at it. |
|
Yeah, if we could get rid of the space sensitive syntax that would be great. Not sure how it could be done though? |
Yes please, I'd be hugely in favor of that. I feel like semicolons are a little bit underutilized inside array literals. Would making |
|
Dissenting opinion on removal of space-separation: DCMs everywhere will weep softly at needing to have visible syntax separating their elements. vs. (This has been a message brought to you by Julia Users for the Protection of Small, Dense Matrices.) |
|
I am no longer convinced by my own argument ... |
|
The pretty matrix input format seems like it can be solved in other ways, that doesn't make a = Matrix"""
0 1 0
-1 0 0
0 0 1
"""And it could also be made to support picking variables from the environment (with or without the |
|
Another +1 for removing space sensitivity, despite the concerns about conflating rows and columns. I think dealing with tensions between whether inputs are rows or columns is going to be big problem for generalizing to n-dimensional inputs. |
|
Interestingly this change actually makes the space-sensitive syntax worse, since there is no 1-element version of it: Here's a weird idea: we could require tab as a separator here, making TSV nearly valid input syntax. |
Worse than invisible is invisible but indistinguishable. After wrestling with YAML files and Makefiles, I don't want any of that. The string input syntax proposed by @ivarne is interesting, though. |
|
I should raise the issue that this is a breaking change, and not just a deprecation. In the current state this branch has no behavior changes, but prints warnings. After merging, we should leave it like that for a little while, then flip the switch. For this to be worth it 0.4 needs the new behavior enabled. |
|
+1 to merge. Better now than later. |
|
This is awesome. +1 to merging and taking off the training wheels once packages have adjusted. 🍰 for everyone involved here. |
use promote_typeof in mixed-type cat functions
|
Why can't |
|
Because you can index by iterators. |
|
|
I think John meant to say that you can index by ranges. |
|
@johansigfrids: |
WIP: Make [a, b] non-concatenating
Maybe for |
|
Re: |
|
No problem, I will make collect faster. We also might want to make vcat
generally less applicable when the deprecation is removed.
|
|
FWIW, this change causes the "Don't overuse splicing" style advice (https://julia.readthedocs.org/en/latest/manual/style-guide/#don-t-overuse) to be outdated. |
|
Thanks for the work you've been doing so far on the documentation, @lostanlen! |
Brings @nolta's
mn/sanecatbranch up to date. Addresses #3737 #2488. Part of #7941.