Skip to content
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

Support American (USA) spelling of @behavior #9269

Closed
sikanrong opened this issue Aug 7, 2019 · 7 comments
Closed

Support American (USA) spelling of @behavior #9269

sikanrong opened this issue Aug 7, 2019 · 7 comments

Comments

@sikanrong
Copy link

Environment

  • Elixir & Erlang/OTP versions: all versions
  • Operating system: all OS

Current behavior

defmodule MyMod do 
    @behavior GenServer
end

warning: @behavior attribute is not supported, please use @behaviour instead

Expected behavior

(should accept the "@behavior" attribute just as it would "@behaviour")

In general, the language should always support both British and US spelling styles, so as to be maximally inclusive to the global development community.

@sikanrong
Copy link
Author

Fun observation: even the Github issue template for this project uses the US spelling "behavior". US spelling style is doubtlessly the one in more common use throughout the world.

@josevalim
Copy link
Member

Please start a discussion on the elixir core mailing list but generally speaking, having two ways of doing the same thing is arguably worst than having a single way, even if surprising.

@sikanrong
Copy link
Author

having two ways of doing the same thing is arguably worst than having a single way, even if surprising.

While normally I would agree; I just don't see this as being two ways of doing the same thing. I could see how it could be interpreted that way, but really all we're asking for is an alias.

@josevalim
Copy link
Member

Well, it is literally two ways of achieving the same behaviour. :) If we add this, we increase the odds that in the same codebase some can use @behaviour and others use @behavior. Especially on teams composed by different people around the world, which will more naturally pick one or another.

@fertapric
Copy link
Member

For the record, this was supported at some point and deprecated probably for the reasons @josevalim mentioned above

@wojtekmach
Copy link
Member

If we support @behavior then arguably we should also automatically define a module.behavior_info/1, IO.ANSI.colour* aliases and likely much much more, and I'm not sure if that's beneficial enough to justify all these changes.

@sikanrong
Copy link
Author

@wojtekmach actually this is really the change that I'd wanted to see - that everything with a british spelling to be aliased with the US spelling as well.

Anyway guys, after reading your comments I can at least better understand the logic behind not supporting it, and the fact that perhaps it would not be desirable that in a given project people might be using both spellings, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants