-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Define lib.name #600
Comments
(To be clear this is about namespacing in the For slightly more flexibility going forward, maybe the define should actually be |
This would make for weird |
Maybe the |
Doesn't haxelib already define |
While we're here, there is also another relevant problem I would like to solve, related to #529 and #568. Haxelib names are case insensitive but defines are case sensitive. This is especially an issue because right now (haxelib 4.1.0), if a library is installed as This means that #if blocks could be activated or deactivated based on a typo, where someone uses I can think of two possible solutions to this problem:
|
Mhh. Now that I've seen the PR, I'm beginning to wonder what's being accomplished with this? |
The issue is that currently there is nothing preventing someone creating a haxelib with a name that clashes with a built-in haxe define flag. Setting the flag with the |
Hmm. Seems slightly paranoid and definitely futile. Who in their right mind would want to publish a library that clashes with the compiler's defines? And if such evildoers existed, how does this stop them, given that they can put To me this feels like red tape. Maybe well intentioned red tape. But still ... |
I'm more concerned about this happening unintentionally. There are a lot of define flags currently: https://haxe.org/manual/compiler-usage-flags.html, some of which already have quite generic names which could easily be used as library names. At least 14 are already package names on npm. Granted, npm has a different culture, but this shows that this is not an unreasonable concern. The list of flags and the list of libraries on haxelib are both constantly growing. Library authors shouldn't be expected to check the full list of compiler flags to know what library names are safe to use without odd side effects in compilation. New library authors may not even be aware that this haxelib define feature exists. An alternative solution is adding submission checks to check the name against the list of define flags, but that isn't future proof and doesn't work the other way around, so every time a new compiler flag is added, a haxelib search would also have to be performed to avoid clashes. I think this is pretty limiting, and working around these potential clashes would be pretty awkward. The
I agree that we can't stop bad actors, but as I said I don't think it is crazy to think that someone could do this by accident. I also think there is a difference between a flag being set explicitly and a flag being set inadvertantly due to an internal feature of haxelib. |
That sounds like a rather hypothetical problem. Haxelib has something in the order of 1000 libs, npm has over a million. Not sure it makes sense to compare these things, but if we do, then I think this is a bit as if the node team decided to say that in the future one will have to write
Agreed. Of the concerns brought up here, this one weighs heaviest, by a large margin. The less obstacles we have for new library authors, the better. As you pointed out yourself, this could be prevented by not allowing users to create such libraries.
If that is really a concern, the CI could check defines.json against haxelib. That said, defines are not added by newbies. The rate at which generically sounding defines are added has decreased considerably over the years. The vast majority of the existing ones come from the dawn of Haxe, when people were adding new backends at 6am, after drinking all night at a conference, and when namespacing defines wasn't even possible in the first place. A whole lot of those time-honored artifacts would best be namespaced (e.g. I guess there thing that bothers me is that this will be quite awkward in many places. For example library subflags. If in the future it is Obviously, these would be nuisances at best. But personally, I don't think further minimizing an already quite limited risk is worth adding this level of awkwardness. |
We decided (5 minutes ago) that for Haxe 5 it would be nice if libraries namespaced themselves. To ease transition, haxelib should emit both
-D name
and-D lib.name
for the time being. This allows users to move towards the latter, which should then still work fine in Haxe 4 as long as haxelib is up-to-date.The text was updated successfully, but these errors were encountered: