-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Remove __fish_is_token_n and undunder fish_is_nth_token #8096
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
Conversation
|
This looks good! I think it's worth keeping the old names around, though - I can see a few uses of them in third-party repositories and so on. I am not sure about "un-dundering", and I'd appreciate other thoughts. There are lots of these completion-helper type functions ( |
|
I think it's OK to have some duplication here, and only promote them as needed. |
Do you mean that I should keep both I was also thinking of editing the description for |
7baf280 to
13c6972
Compare
So, as it is currently, we use the dunder to signal one or both of two things:
The first would only really be of use if we ever decided to "stabilize" something by un-dundering it. And since we currently don't do so, in practice dundered functions are used all over the place and we don't really have the moral authority to tell people to stop using them, and so we don't want to break them. We even recommend dundered methods in the docs! (in practice we do limited compatibility breaks anyway and it works out alright) The second is generally used for completion helpers like these that don't appear in "ordinary" fish script. You wouldn't use this in your prompt. So to achieve having a layer of "unstable" or "internal" functions, we would have to un-dunder some, but that loses the property of having them ignored in completions. I'm not super sure if that's useful, and we could also use a single underscore instead and document that convention (we've attempted that before with Or we could decide that we don't really break compatibility in these a lot and we don't need the first property, in which case it's down to the aesthetics of the dunderscore vs having these show up in completions. I'm also not really sold that any convention will actually be followed by our users - look at how some people still hit the And once we un-dunder one thing (that's not user-facing like fish_git_prompt - which we have undundered), we should probably commit to doing that more, or we end up more inconsistent than before. Is that worth it? Can we say which functions are really "stable"? What convention should we use? TL;DR: Dunno? |
|
In the interest of moving this along (sorry, @anrddh): As far as I can see, there's a few different kinds of dundered functions:
Of these, I would propose that we undunder and stabilize the key binding helpers and the generally useful helpers. All other things are, in some sense, "internal". So that means this can go in, other functions can start being undundered, documented, stabilized and cleaned up. We should start to figure out a deprecation system that works for these as well (#8131). Unless anyone objects, I would like to merge this PR this weekend, and we can eventually start moving on the rest (although it's not critical, there's no rush). |
I hadn't thought of this, but it's a useful consideration. But |
b478aa9 to
9c840f6
Compare
|
I've cleaned up the branch and commits. Please let me know if you'd like me to make any other changes. |
We keep __fish_is_nth_token for compatibility and edit the implementations of __fish_is_nth_token, __fish_is_first_token and __fish_is_token_n to use fish_is_nth_token
9c840f6 to
8b2b713
Compare
|
Merged, thanks! |
Also edit the implementation of __fish_is_first_token to use fish_is_nth_token.
Fixes issue #8008
TODOs: