This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add line information to more generated code (#144)
In some places we are willfully omitting line information by passing `nothing` to certain `Expr`s, and in others we're generating expressions that are syntactically valid but are not what Julia itself produces. Part of that is the omission of line information. This changes the function definition expressions from things like ```julia f(x::Node{Int}) = Branch(f, (x,), getfield(x, :tape)) ``` to ```julia function f(x::Node{Int}) #= line info here =# Branch(f, (x,), getfield(x, :tape)) end ``` "What's wrong with the former?" you might ask. Nothing in principle, though if you were to write that in your own code, Julia parses it as ```julia f(x::Node{Int}) = begin #= line info here =# Branch(f, (x,), getfield(x, :tape)) end ``` For ease of visual parsing, we'll change it to use `:function` expression heads, i.e. long-form function definitions, as it's functionally equivalent. The benefit of having line information is for backtraces. If something goes wrong, the user should now be able to get a better idea of where a problem is, rather than Julia providing a backtrace that just says something along the lines of "in Nabla."
- Loading branch information
Showing
3 changed files
with
74 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters