-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global imports #41158
Comments
Did you intend to link to a C# issue? Please paste the full link if so. I find it surprising that this would be considered a good idea. Isn't it better for each piece of code to declare its dependencies? Is there a killer example of when this is useful? |
This could perhaps be expressed via something like Reexport.jl. Or something reversed of that? Perhaps you could write |
Thanks for the remark about the link! Didn't realize I pasted in the wrong link. Fixed it now.
I do not find that "global imports" in ASP.NET Core make the code any less readable. Actually, the "global imports" in ASP.NET Core are always inherited downwards and so the imports locations are clear depending on a file's location in the file system. One One way to go about it would be to define a specific "Imports.jl" file that would then act as the global import file.
I do consider the ASP.NET Core MVC |
This does somewhat touch the same issues as global imports, but there would still be the extra boilerplate. Nice find anyway! |
It seems this is the latest effort to provide .NET wrapper Other related issue |
This doesn't seem like something we are likely to add, and could be converted to a discussion, or moved to discourse. |
A global import statement could provide various benefits to Julia. Consider the following:
Main.jl
Project.jl
Executing Main.jl would throw an error at the inclusion of Project.jl, becuase the module Module1 is not imported in the file.
Introducing a new syntax
global import
(or equivalent) the code above could work and would provide benefits. In fact, the modules Core and Base can almost be considered as global imports, since they are implicitly imported into each module (not countingbaremodule
).This is not a new feature and has been implemented in several other languages or frameworks, for example, ASP.NET Core MVC utilizes global imports with special
_ViewImports.cs
. This feature has also been proposed for general use in C# 10. You can see the discussion about that here: dotnet/csharplang#3428. The feature has now been moved from a "candidate" to a "working set" proposal.The text was updated successfully, but these errors were encountered: