Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

where-syntax accepts ; as separator in 0.6 #23211

Closed
mauro3 opened this issue Aug 11, 2017 · 5 comments
Closed

where-syntax accepts ; as separator in 0.6 #23211

mauro3 opened this issue Aug 11, 2017 · 5 comments

Comments

@mauro3
Copy link
Contributor

mauro3 commented Aug 11, 2017

On 0.6 this works but shouldn't (note the ;):

julia> g(::T, ::Y) where {T;Y} = 1                   
g (generic function with 1 method)                   

julia> g(4,5)                                        
1                                                    

In 0.7 this errors as expected. Could this be back-ported to 0.6? This is a feature I plan to use in SimpleTraits.jl.

@StefanKarpinski
Copy link
Member

How would one use the fact that it's a syntax error on 0.7? Are you asking to allow the semicolon on 0.7 or disallow it on 0.6?

@mauro3
Copy link
Contributor Author

mauro3 commented Aug 11, 2017

I think it's possible to allow to parse it but then throw an error later. This seems what's going on in 0.7:

julia> :(g(::T, ::Y) where {T;Y} = 1)                                                                                                                                                                              
:((g(::T, ::Y) where {T; Y}) = begin                                                                                                                                                                               
            #= REPL[2]:1 =#                                                                                                                                                                                        
            1                                                                                                                                                                                                      
        end)
                                                                                                                                                                                                                   
julia> g(::T, ::Y) where {T;Y} = 1                                                                                                                                                                                 
ERROR: syntax: invalid variable expression in "where"                                                                                                                                                              

That way the syntax can be used in macros.

@JeffBezanson
Copy link
Member

This can't easily be backported since on 0.6 {a,b} and {a;b} parse the same.

@mauro3
Copy link
Contributor Author

mauro3 commented Aug 11, 2017

Ok, not to worry. I'll just have to drop 0.6 compatibility when moving to 0.7.

@mauro3 mauro3 closed this as completed Aug 11, 2017
@StefanKarpinski
Copy link
Member

That is what we will be encouraging all package maintainers to do once 0.7/1.0 is released.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants