Free up curly brace syntax. #8578

Merged
merged 7 commits into from Oct 9, 2014

Projects

None yet
@jakebolewski
Member

The fate of the {} syntax has been debated in #7941, #7128, #2488, #6739 and many other threads that I cannot dig up at the moment. The current syntax is slated to change in 0.4. My suggestion was outlined by Jeff in #8470. Whatever we decide to do, this change makes it easier to transition to allowing [a, b] to be non-concatenating (#3737) and regularization of Dict syntax #8521.

The parser should probably be changed to reject the {} array / dict syntax during the transition period. Would throwing an error be sufficient? This will be a hugely breaking change so I thought I would solicit some feedback on that.

@jakebolewski jakebolewski added this to the 0.4 milestone Oct 4, 2014
@jakebolewski jakebolewski changed the title from WIP: Free up curly brace syntax. to Free up curly brace syntax. Oct 5, 2014
@tonyhffong
Member

I'm thinking, in Lint, I could add a trigger like "Using {} for Any[] may be deprecated in Julia 0.4" for julia VERSION < v"0.4-". It may help 0.3 users future-proof their code a bit. What do you think?

@johnmyleswhite
Member

+1 to that

@tonyhffong
Member

So it is done.

@staticfloat
Member

This is gonna be another one of those "real" 0.4 changes. :) Now we just need a catchy name like the itruncalpyse.

@elextr
elextr commented Oct 6, 2014

bracalypse?

@StefanKarpinski
Member

curlpocalypse?

@quinnj
Member
quinnj commented Oct 6, 2014
  • The Curly Wars
  • The Curly Curtain
  • Curly Crusades
@tonyhffong
Member

Curler iron.

I'll show myself out.

@jakebolewski
Member

Brought up to date with latest dictionary syntax changes.

@JeffBezanson what are your thoughts on this? I could add a deprecation warning for the time begin for {} arrays similar to dictionaries. I would like to implement #8470 but that means there really is no "deprecation" behavior for {}.

@JeffBezanson
Member

For a little while, let's print a deprecation warning but keep it working the same and use Tuple{...} for tuple types.

@StefanKarpinski
Member

I wonder if it makes sense to backport some deprecations to the 0.3 branch without breaking any functionality. That way people can have more chance to prepare for some of these bigger changes.

@staticfloat
Member

We would have to make sure that the new functionality actually works
though, right?
On Oct 6, 2014 2:55 PM, "Stefan Karpinski" notifications@github.com wrote:

I wonder if it makes sense to backport some deprecations to the 0.3 branch
without breaking any functionality. That way people can have more chance to
prepare for some of these bigger changes.


Reply to this email directly or view it on GitHub
#8578 (comment).

@StefanKarpinski
Member

Yes, of course. Might not be practical.

@jakebolewski
Member

I feel that this would be better handled by external tools rather than cluttering up the parser in Julia.

@staticfloat
Member

Agreed. Some kind of lint tool, or .12 tool or something would be nice. ;)

@jakebolewski
Member

Updated with deprecation warnings.

@tonyhffong tonyhffong referenced this pull request in tonyhffong/Lint.jl Oct 7, 2014
@tonyhffong tonyhffong Inform comprehension {} deprecations 94a1b1e
@jakebolewski
Member

Is this good to merge?

@JeffBezanson JeffBezanson commented on an outdated diff Oct 9, 2014
base/deprecated.jl
@@ -108,7 +108,7 @@ eval(Sys, :(@deprecate shlib_list dllist))
@deprecate put put!
@deprecate take take!
-@deprecate Set(a, b...) Set({a, b...})
+@deprecate Set(a, b...) Set([a, b...])
@JeffBezanson
JeffBezanson Oct 9, 2014 Member

Needs Any to avoid concatenation.

@JeffBezanson JeffBezanson and 1 other commented on an outdated diff Oct 9, 2014
src/julia-parser.scm
@@ -1812,7 +1818,9 @@
(length= (cdr x) nc)))
(cddr vex)))
(error "inconsistent shape in cell expression"))
- `(cell2d ,nr ,nc
+ (begin
+ (syntax-deprecation-warning s "{[a,b] [c,d]}" "Any[[a,b] [c,d]]"))
@JeffBezanson
JeffBezanson Oct 9, 2014 Member

Shouldn't this be {a b; c d} to Any[a b;c d]?

@jakebolewski
jakebolewski Oct 9, 2014 Member

Yes, should be fixed.

@JeffBezanson
Member

Merge away.

@jakebolewski jakebolewski merged commit 264fba7 into master Oct 9, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@jakebolewski jakebolewski deleted the jcb/rmanyarray branch Oct 9, 2014
@PythonNut
Contributor

I can't help but ask (as I've been looking for the answer for a while now), what do you intend to do with curly braces now that they're "free"?

@JeffBezanson
Member

#8470 is one likely possibility, but suggestions welcome!

@simonster simonster added a commit to JuliaLang/JuliaDoc that referenced this pull request Oct 15, 2014
@simonster simonster Fix deprecation warning for JuliaLang/julia#8578 05e4eae
@simonster simonster added a commit to simonster/Reexport.jl that referenced this pull request Oct 15, 2014
@simonster simonster Fix deprecations from JuliaLang/julia#8578 befb707
@simonster simonster added a commit to JuliaCollections/Iterators.jl that referenced this pull request Oct 15, 2014
@simonster simonster Fix deprecation warnings from JuliaLang/julia#8578 49d33c6
@simonster simonster added a commit to JuliaIO/HDF5.jl that referenced this pull request Oct 16, 2014
@simonster simonster Fix deprecations from JuliaLang/julia#8578 bf62076
@vtjnash vtjnash modified the milestone: 0.4-projects, 0.4 Oct 17, 2014
@vtjnash
Member
vtjnash commented Oct 17, 2014

can we get a NEWS.md item for this? I almost missed it, and it's a pretty significant change.

also some places in the manual might still need to be updated (http://docs.julialang.org/en/latest/manual/noteworthy-differences/?highlight=matlab and http://docs.julialang.org/en/latest/stdlib/punctuation/?highlight=cell)

@catawbasam
Contributor

Regarding new uses for brackets, using them for Dict/Hash would align the syntax nicely with Ruby, and move it a step closer to JavaScript/Python/JSON. If they were used for Sets as well, that would match Python.

(I'd love to see Julia's Dict literals match the familiar and finger-friendly syntax of Python/JavaScript/JSON, but would guess further use of ':' might be tough to make work well.)

@tkelman
Member

@jakebolewski why does this disable the random tests?

Member

A typo, I did not intend to do that.

Member

K. I put it back in 4125f4c

@DSLituiev DSLituiev pushed a commit to DSLituiev/JLD.jl that referenced this pull request Oct 19, 2015
@simonster simonster Fix deprecations from JuliaLang/julia#8578 0d92304
@iamed2 iamed2 referenced this pull request in JuliaCollections/Iterators.jl Sep 20, 2016
Merged

Drop 0.3 and support 0.5 #72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment