AST nirvana


#1

I’m in general a huge fan of Julia AST’s. But there’s a few changes I’d make if I could:

Line numbers would not be separate arguments to begin blocks. Instead, there would be a :numbered_line head which takes two arguments: a line number and a line. See NumberedLines.jl for a prototype.

Julia would able to use :parameters not matter what argument order it appears in the AST. Moving it to the front by default doesn’t make to much intuitive sense to me.

Type fields would not be in a begin block, because they aren’t evaluated like a block of code.

In an expression like this: (args...; kwargs...) -> map(args...; kwargs), the first pair of args, kwargs wouldn’t be put into a begin block for the same reason as above.


#2

It is better if they are kept at the end since that where they have to be but they shouldn’t be allowed anywhere. There’s no such syntax.

I don’t think inventing a new node would help. This also make it much easier to construct the fields declarations.


#3

I don’t think inventing a new node would help

Why not?


#4

Why would it? I can only see that it makes it harder to construct or detect one. Having identical evaluation / lowering rule is not and is never going to be a property of the AST.