Exporting all symbols in Julia

烈酒焚心 提交于 2021-01-27 04:31:26

问题


Is there a way to export all symbols in a Julia module (something like the semantic counterpart to importall)? Such a functionality would be very useful when the number of symbols to be exported grows large. TIA.


回答1:


There's the Reexport.jl package that provides a form of this; it's use case is when you have a submodule and you want to reexport all of the exported symbols from the inner module into your current module. I know, not exportall, but part of the functionality.




回答2:


I wrote a minimal ExportAll.jl package. It works and is tested for Julia 1.1.1 and it is available as a Julia package. Basically, it exports all symbols(!) defined in a module that is not part of any of the core modules. Disclaimer doing things like this is not good practice and should only be done with great care.



来源:https://stackoverflow.com/questions/25203560/exporting-all-symbols-in-julia

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!