-
Notifications
You must be signed in to change notification settings - Fork 49
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
glob order oddity involving multiple files #614
Comments
It looks like the order on path either first separates by length (so a longer long name will always be ordered after a shorter one regardless of the relative ordering of their first elements), or always orders Independently of this explanation is the question of whether this is desired or not. I don't think there is any way for us to do anything that both:
Here, 1 is clearly desirable, and 2 slightly less clearly so. But the fact that the order doesn't change just because you import So, likely, the best we can do is 1) pick something that makes sense, and 2) document it. Now the question 1 of whether the current ordering on paths makes sense is good. I think it does if you think "local first". We could debate this, but we could also explain it. And beyond simply documenting that explanation, one way to perhaps improve this in the tool itself is to always print the name we used in deciding the order, or perhaps print out comments clarifying long names that were used in ordering, but shortened by imports. (This might require allowing comments in the actual AST...)
|
Thanks, François. We're in the position of trying to machine-generate EC code that uses the glob order. All I really care about is being able to predict it. (So for us, the output of |
For the order used, see Line 341 in 186032b
|
IMO, the solution is #615 |
I'm going to reopen this, because the current solution results in a typing anomaly. The reason is that the ordering used for paths treats longer paths as greater, but this isn't stable when multiple files are involved. More deeply, because the type The following example has three files, Here is
This checks fine. Here is
And here is
This prints out
(note that the order has changed!) and then gives the error
(line 25 is the definition of The order changes because now You may want to close this saying the solution is records, but I wanted to point out the problem with the current implementation. |
There is indeed again an instability. The problem is that in Emacs, the name of the current theory is not the same (because we don't have the current filename). Maybe the order of declaration could be used, but this is a more intrusive fix. |
I'm having trouble understanding the new glob order in a case involving multiple files.
The first file,
GlobOddity1
, isAnd the second is
If instead I make the entire example be in a single file, I get
Is this buggy behavior, or if not, what is the model for why the two file version produces apparently out of order results?
The text was updated successfully, but these errors were encountered: