You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Dub requires that inline recipes (for single-file mode) are at the top of the file, directly following the shebang line. Trying to place them somewhere else results in:
Error The source file must start with a recipe comment.
I think it would make sense to relax this restriction, and allow them to occur anywhere in the file, for the following reasons:
The recipe is an implementation detail, and it's not very useful as one of the first things a reader would want to see at the top of the file.
It would be more useful to start the file with a comment or documentation block, describing what the program does, and an overview of the program.
Dub is not the only tool that benefits from embedding its own machine-readable information in source files.
Some other examples of this are:
Vim modelines
Emacs file-local variables
nix-shell configuration lines
Fortunately, none of these other tools require that their information is at the top of the file. However, if any of these tools did also require that their information had to be placed at the top of the file, then it would be impossible to use them alongside Dub. So, Dub should play nice as well and not expect that it and only it deserves the top-most place in the source file.
Currently, Dub requires that inline recipes (for single-file mode) are at the top of the file, directly following the shebang line. Trying to place them somewhere else results in:
I think it would make sense to relax this restriction, and allow them to occur anywhere in the file, for the following reasons:
The recipe is an implementation detail, and it's not very useful as one of the first things a reader would want to see at the top of the file.
It would be more useful to start the file with a comment or documentation block, describing what the program does, and an overview of the program.
Dub is not the only tool that benefits from embedding its own machine-readable information in source files.
Some other examples of this are:
nix-shell
configuration linesFortunately, none of these other tools require that their information is at the top of the file. However, if any of these tools did also require that their information had to be placed at the top of the file, then it would be impossible to use them alongside Dub. So, Dub should play nice as well and not expect that it and only it deserves the top-most place in the source file.
An example program that would benefit from this improvement: https://github.com/CyberShadow/misc/blob/eb1cd77866fc0bcad37d9513d611b0de49357695/git-copy-revs.d
The text was updated successfully, but these errors were encountered: