Open ParadaCarleton opened 8 months ago
This was allowed by the previous parser so removing it would be technically breaking:
julia> dump(JuliaSyntax.fl_parse("import InverseFunctions as if"))
Expr
head: Symbol import
args: Array{Any}((1,))
1: Expr
head: Symbol as
args: Array{Any}((2,))
1: Expr
head: Symbol .
args: Array{Any}((1,))
1: Symbol InverseFunctions
2: Symbol if
The import
currently does work "as expected" in some technical sense. It's just that if
is not a valid identifier and must be written as var"if"
when it's used later in the code. For example:
julia> import Unicode as if
julia> var"if".graphemes
graphemes (generic function with 2 methods)
On further consideration, I do agree that this is confusing, and ideally could be deprecated in future as a warning, then an error. The amount of breaking would need to be assessed, but would probably be low.
For readability, it would be better to force the user to write the following if they really want bizarre identifier names:
import Unicode as var"if"
My two cents are that we should treat this as a bug/unexepected behaviour in the flisp parser.
Not sure if this is supposed to be allowed, or if it's supposed to be an error (in which case I think it would be better to error when importing).