Distinguish dictionary lookup from nothing and not found?

The motivation here is that some kinds of macro expansions (like pattern matching) requires heavy computation at runtime and makes the Julia startup latency issue severer.

There is nothing related to source code distribution. For development, the original source code must be provided, and at some stage it could be very possible to just work on the generated code. Besides, original source code files can be optionally distributed for error positioning and better error messages, even if these files are not executed at all, and the macro package is not required at runtime.

I heard of system image building a thing but never looked into it yet, but even in that scenario, I think you can bundle your MyNothing struct into the built image.

There are many solutions but most of them require runtime dependencies. I donā€™t think system image has much to do with this issue. Dev-time only deps are reasonable and useful entities in the world of programming, we are just trying to bring these beneficial stuffs to Juliaā€¦

Iā€™m not sure I understand it correctly, but by far I suppose that ā€œmacro expansionsā€ always happen at compile time, no? So I donā€™t quite understand why it ā€œrequires heavy computation at runtimeā€?

At least with 1.7+, I see ā€œJulia startup latencyā€ can be vastly mitigated by pre-compilation, if an end package using your macro package can manage to pre-compile its functions involving the expansion of your macros at usage site, isnā€™t that fairly acceptable? What mechanism can actually further improve the situation beyond that?

Two years ago the latency issues are more visible, and removing compilation-like macros from a library can reduce the loading time. Recently, a precompiled Julia package does not suffer much from toplevel interpretation, but packages are not always precompiled, such as in development time. Also, certain macros do not work well with hot reloading, so avoiding compilation when debugging is meaningful. There were other cases that precomilation is not available, like calling Julia in statically linked Python. You might check PyJulia for the issues, and if you are interested, I can introduce more background for you in another thread.

Other than scenarios I used to explain ā€œruntime-freeā€, even if recently some issues involved above get partially addressed, a mechanical approach to removing runtime deps and introducing dev-time only deps is attractive. And weā€™d better stop here because the discussion gets off-topic.

You can check out the PRs mentioned in this thread for more understandable scenarios of distinguishing default values and missing values.