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

fix #5154 (nested for loop syntax & break behavior) #7430

Merged
merged 4 commits into from
Jul 3, 2014

Conversation

nolta
Copy link
Member

@nolta nolta commented Jun 26, 2014

Output of:

julia> for i=1:3, j=1:3
           println("$i $j")
           i == 1 && j == 2 && break
       end

before:

1 1
1 2
2 1
2 2
2 3
3 1
3 2
3 3

and after:

1 1
1 2

@JeffBezanson
Copy link
Sponsor Member

Wow, thanks, I forgot about this one. I think it would be good to put this in 0.3.

@JeffBezanson JeffBezanson added this to the 0.3 milestone Jun 28, 2014
@quinnj
Copy link
Member

quinnj commented Jun 30, 2014

+1

(if (null? r)
body
`(for ,(car r) ,(nest (cdr r)))))))
`(for ,(car ranges)
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should parse as a single for expression, with a (tuple ...) of the ranges. The parsed form should visually match the source code. All the inner- forms will then be confined to lowering, where they will not bother people.

@JeffBezanson
Copy link
Sponsor Member

Ok I think this is now ready to go.

JeffBezanson added a commit that referenced this pull request Jul 3, 2014
fix #5154 (nested for loop syntax & break behavior)
@JeffBezanson JeffBezanson merged commit dd85daa into master Jul 3, 2014
@tkelman
Copy link
Contributor

tkelman commented Jul 4, 2014

According to bisect, merging this (dd85daa) caused the following test failure on Win64:

Tony@TK-samsung ~/julia/test
$ ../usr/bin/julia runtests.jl spawn
     * spawn
       [stdio passthrough ok]
exception on 1: ERROR: new not defined
 in IPv4 at socket.jl:15
 in connect at socket.jl:600
while loading spawn.jl, in expression starting on line 134
ERROR: new not defined
 in IPv4 at socket.jl:15
 in connect at socket.jl:600
while loading spawn.jl, in expression starting on line 134
while loading D:\cygwin64\home\Tony\julia\test\runtests.jl, in expression starting on line 46

Looks a little like #5153?

@tkelman
Copy link
Contributor

tkelman commented Jul 4, 2014

And it went away again. The hell?

@JeffBezanson
Copy link
Sponsor Member

That is a very slippery error, probably GC-related, that is very sensitive to the exact allocation workload.

GaZ3ll3 referenced this pull request in JuliaCN/julia_zh_cn Jul 12, 2014
@JeffBezanson JeffBezanson deleted the mn/nestedforbreak branch July 13, 2014 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants