-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add pseudo-encapsulated require
#4461
Comments
I'm not sure it is solving #4368 completely - if e.g. shard A use shards B,C,D, and user program use only shard A, then Hmm, if all shards follow the same rule and never |
@konovod Yes, the expectation would be for all libraries to use this |
Please don't just throw some technical solutions without explaining the rationale. This subject is controversial and has been rejected a few times. Be more explicit about what you're trying to solve; refer to actual problems that actually happened, not personal anecdotes, or the argument that some other languages do this (so what? I don't use it) or worse: the possiblity that something may happen someday. The actual |
Because it doesn't modify existing behavior at all while solving all of the issues (and many were mentioned) detailed throughout #140, #4368, #4439, and probably others I have missed. Are you saying you don't see any issue mentioned in those tickets that is an actual issue? If so, I will dig up others, because there are others. My question is: if you have the option of having naming conflicts, why would you choose the option of being forced to allow them over eliminating them? This proposal provides a tool (that you can choose to use or not to use) to eliminate this maybe infrequent, but significant problem. (Is there a reason a conflict is to be desired?) While we're at it, let's get rid of The complexity added to Every rejection to similar proposals that I have seen so far has boiled down to not wanting to modify/break the |
I'm closing this. If one day a different way to require code appears, it will come from the core team. Please don't send any more proposals related to this. Thank you. |
The conventional way to introduce a new library in Crystal is to use a global
module
, and Crystal does not currently provide an automated way of dealing with naming collisions.I propose a system that effectively eliminates the need to introduce a new global when creating a new library. This is accomplished by a new keyword:
package
(or maybeshard
or something similar). Apackage
is a globalmodule
which is dynamically named at compile time and which is meant to be used in aprivate
context as the following example will show:Now let's see how to put
Library
to use in a project:This proposal plays well with the
require
system + monkey patching and provides a solution to all issues raised in #140, #4368, #4439 without breakingrequire
in any way as far as I can tell.The specifics are of course up for discussion.
Thoughts?
The text was updated successfully, but these errors were encountered: