-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: constraints: rename package to "of" #50348
Comments
There seems to be a pattern; the But seriously, if you think it reads better, you can rename the import thusly
|
Too bad |
My suggestion was |
Bikeshed entry number 4: I do agree with the implication of the original comment that 'constraints' feels cumbersome. |
The name of the package was brought up (as @fzipp mentioned) in discussion, and @rsc marked it as resolved. I agree "constraints" is quite long, but I don't see what's changed. |
definitely agree, "constraints" is cumbersome, hope the go team make some change in the future |
Is it a good idea to make them all pre-declared? |
Not in my opinion. It's possible to write these in the language (which is a good thing), so there is no reason to predeclare them. |
My vote at the time of the discussion was |
|
|
how about |
maybe someday we will adds some types like |
@zhuah std is already taken; see: go list std |
Dave is pleased to joke, but you absolutely shouldn't do that. |
just use an alias |
@mvdan thank you for clarification, i almost forgot it. |
I think it's worth considering that in my experience so far the most commonly used identifier in the package currently named "constraints" is |
If we want to avoid the ambiguity of |
I prefer
|
On their own, the package names |
From the Go blog on package names: "A package name and its contents' names are coupled, since client code uses them together. When designing a package, take the client’s point of view." Take
Re readability: Reading the package name Re documentation/discovery: Every package has a short description that is displayed in the package overview https://pkg.go.dev/std and in the documentation of the package itself. This is discoverable via search engines and Ctrl+F. There is no shame in short package names if they are expected to be used a lot. The popular string formatting package was named |
Code cleanness is a big advantage of Go. We should not forget this. |
Okay, but here we have the opposite situation. Also, |
These are my bikeshed entries:
In addition to the name "constraints" being cumbersome I also think |
This proposal has been added to the active column of the proposals project |
There's always "curbs", which is 6 runes shorter. |
We added this to the proposal minutes to see if any new information came in since the previous discussion. It looks like there has not been. The reasons for constraints at this point are:
|
I think the thing we want to know is “how annoying is it in practice that signatures with ‘constraints’ will be rather long?” Fortunately, if the answer turns out to be “very” we can just use an import alias in the short term and introduce a new package in the long term, so it’s not an irrevocable decision. |
Apart from having to type it the main drawback of long names is imho readbility when you have more then one or two parameters. It distracts people and leads to hard-to-read, long signatures. |
Based on the discussion above, this proposal seems like a likely decline. |
Not sure. Is got 19 thumbs up. Would that need a new proposal? |
Any renaming of |
Point 1 is not itself enough, since the release has not happened yet, and we are in the phase of finalizing decisions. A decision can change. It's not a cost-free change, but it's doable. Not sure about point 2. The word "constraints" is just so long and not, in package-name space, Go-like. Plus the impliciti analogy with "bytes" and "strings" is specious, since the package isn't about functions that operate on things, it's a set of type definitions to enable functions. Point 3 is a reach, I think. Honestly I believe some of the shorter suggestions read very well. The pre-existence of a package in the open source world is not a problem: there are countless name collisions. Enabling them was part of the design of packages. Point 4 is true, but is it critical? Sorry to push on this, and I see the "likely decline", but I still feel "constraints" is an ugly name to put in a function definition. @carlmjohnson's point about frequency is a good one to consider. |
If everyone aliases the import to something else, I would consider that more of a readability concern than having an import that's not immediately clear the first time you see it. |
We have an example of how the length of
I am not partial to any of the suggested names, but it seems to me
Also compare with this layout I suggested in #47330 (reply in thread)
|
Note that thanks to #48424 there is no more func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, cmp func(V1, V2) bool) bool It's certainly true that |
Even if those particular references are no longer valid those are still examples of a small number of uses of |
Honest question: can you point us to those examples? Thanks. |
I meant that the examples using |
No change in consensus, so declined. |
snippet code
it is simple and smooth to type the word "of" better then "constraints"
The text was updated successfully, but these errors were encountered: