# AST nirvana

**URL:** <https://discourse.julialang.org/t/ast-nirvana/1768>\
**Category:** Internals & Design\
**Created:** [January 29, 2017, 5:49pm UTC](https://discourse.julialang.org/t/ast-nirvana/1768 "2017-01-29T17:49:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bramtayl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bramtayl/32/3614_2.png) [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Post date:** [January 29, 2017, 5:49pm UTC](https://discourse.julialang.org/t/ast-nirvana/1768/1 "2017-01-29T17:49:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 29, 2017, 7:33pm UTC](https://discourse.julialang.org/t/ast-nirvana/1768/2 "2017-01-29T19:33:04Z")

</div>

> [@bramtayl](#):
>
> 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.

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.

> [@bramtayl](#):
>
> Type fields would not be in a begin block, because they aren’t evaluated like a block of code.

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

---

<div class="post-metadata">

**Author:** ![bramtayl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bramtayl/32/3614_2.png) [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Post date:** [February 20, 2017, 3:33am UTC](https://discourse.julialang.org/t/ast-nirvana/1768/3 "2017-02-20T03:33:13Z")

</div>

> I don’t think inventing a new node would help

Why not?

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [February 20, 2017, 4:16am UTC](https://discourse.julialang.org/t/ast-nirvana/1768/4 "2017-02-20T04:16:14Z")

</div>

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.
