-
Notifications
You must be signed in to change notification settings - Fork 26
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
The names for Inflector functions
could be better
#21
Comments
Inflector functions
is not goodInflector functions
could be better
I'm not sure I agree with the notion that these namings are not understandable in the context of elm. We chose these names because these are inspired from their underscore.string counterparts. I agree that using inflector as a header is bad and we should replace that with something else, or drop it entirely. I would be fine with moving to more "descriptive" names, if we keep aliases around for the current names. |
Well, to start with, these names are not consistent to String.Extra. Take a look at the converstion functions here: http://package.elm-lang.org/packages/elm-community/string-extra/1.4.0/String-Extra#toSentenceCase. These are the names which you would expect in Elm. Please respond to each of these function names and explain the existing names, if you think the existing one is better:
Please remember that just because a function name is familiar to you does not mean it is familiar to the rest of the Elm community. We do not use the same naming as Ruby. Keeping these as aliases is not really an option. We do not want multiple names for one function. Just mention |
From Slack: As a general recommendation, please do not name things just because another language calls them something. Especially in the case of {-| Takes in a string and converts it to camel case. The first character will become lowercase, while the first letter of each subsequent word will become uppercase. The spaces between each word will be removed. This is known as `camelize` in Ruby.
.... examples
-}
toCamelCase : String -> String This way people can still find it via |
I like the new names you proposed, would you like to send a pull request with the changes? |
I don't want to dictate the names -- if @jaapz thinks the existing names are worth keeping, then I'd like to hear them out first before doing it. 😄 |
I'm fine with new names and understand the reasoning behind it, but making breaking changes by changing the names around without leaving aliases for the old names feels backwards to me. From a practical standpoint it seems to me that keeping aliases would be a small thing to tackle but a big win user-friendly-wise. I personally hate it when people in the npm ecosystem decide to change names around, making me do search and replace work that's not very productive. Though if you and @lorenzo feel it's better to not keep aliases then by all means propose a pull request and I'll happily approve it. |
@jaapz This is less of an issue in Elm, we can do I'll open a PR in a bit |
The issue as a developer is that you still need to change calls to those functions, not that people don't know what changed. I don't think keeping some aliases around will make the API "messy and fragmented". Comparing to the PHP ecosystem is a bit weird, as there is no mixed case issue here. If you feel this strongly that this is the right way and you don't think backwards compatibility is more important here, then like I said, go ahead :) |
@jaapz, any code where this is valid is messy: alwaysTrue someText =
let
asCamel = toCamelCase someText
asCamelToo = camelize someText
in
asCamel == asCamelToo This is not good. Now the developers have to know two names for each function. If you have one developer who is familiar with the If people care enough that they can't bare to rename their functions, they can make an alias at the cost of their own code base. They can make their own code messy -- and not our packages. We do not need to care about backwards compatibility in these packages. We have enforced semantic versioning for this exact reason. You can group the naming changes with other changes if you want, but this is not npm and it's not Javascript. We won't cause downtime by changing function names. We'll cause compiler errors to catch these changes trivially. |
What about marking the existing functions as deprecated in the docs (for example "DEPRECATED: use |
Yes, that's reasonable. |
Inflector
means nothing to me as an Elm developer. Or even as a developer on the whole! I would recommend dropping this subtitle entirely. You can mention that these functions are inspired byinflector functions
, but please do not use it as a heading.camelize
is not a word that I understand in the context of Elm.toCamelCase
would be better.classify
does not sense in Elm. Is it converting to a CSS class? We don't have classes in Elm.toCapsCase
would be better.humanize
seems like a vague definition. Does it fit in with the rest of these functions?toHumanReadable
would be a better nameThe text was updated successfully, but these errors were encountered: