Julia: Inconsistency between `if` and `elseif` parsing

Created on 4 Apr 2016  Â·  6Comments  Â·  Source: JuliaLang/julia

This is legal syntax:

false
end

but this is not:

false
elseif
true
end

(missing condition in elseif). It seems like either both should be allowed or both disallowed.

parser

Most helpful comment

I suppose we should deprecate if<newline>.

All 6 comments

i got in several places the comment: Julia syntax is correct, if the parser accepts it (no, there is no formal syntax definition). So why not just accepting this?

The way we encode the syntax, and what we want the syntax to be, are totally separate issues. It's perfectly possible to specify an undesirable syntax in BNF.

I suppose we should deprecate if<newline>.

I suspect you can just make it an error – I really doubt a lot of people are using this syntax.

There are definitely uses of it in packages as I had disallowed this in JuliaParser and it came up while running against all packages, so a deprecation is in order.

For this (and in general), is JuliaParser.jl thought of? I do not see a commit here (or a label for it, similar to "backport to 0.4"..).

Was this page helpful?
0 / 5 - 0 ratings