I would like to announce a tiny package called InlineExports.jl. It provides a single macro, @export, which allows you to export variables, functions and types at their points of definition. This is best illustrated by an example:
@export function f(x)
@export const answer = 42
@export my_string = "Banana"
FWIW I rather like seeing the list of exports at the top of a package rather than being interleaved with the function/value definitions. I know in an ideal world that info would be easily accessible in the docs, but often it ends up being easier to glance at the top-level src/SomePackage.jl file to see what’s exported.
This is a violation of DRY, as you need to write the exported symbol one extra time. For packages which span many files, keeping this consistent requires some effort, which InlineExports.@export makes unnecessary, so I will be very happy to use it.
Also, note that some packages don’t export the API — this is also a valid style for Julia.
Whether this package is useful depends, on the use case.
Some interops would be placed at several distinct modules for the sake of better code organizationm, and InlineExports.jl could be useful when it comes to export something from an internal module to another(also internal).
Also, the top-level module that describes which APIs to be exported to users, would better not to use @export.