-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add the function call pattern to syntax #179
Add the function call pattern to syntax #179
Conversation
Add the pattern to name the function calls with parenthesis or dot and parenthesis. There is a full explanation about why, on the GitHub PR of this commit. TL;DR Since function calls without the parenthesis raise a compile warning and the formatter add the parenthesis by default, we should support a rich experience for those who follow the language recomendation.
@CaiqueMitsuoka I would rather remove the support for ambiguous calls. They only exist today for backwards compatibillity and they will eventually be removed. Today there is no reason to keep them. What do you think? |
To clarify the above: only |
❤️ 💚 💙 💛 💜 |
Hi folks, this PR has made a huge unexpected change in my editor... all of a sudden most of my code turned green! After looking at this, I'm wondering if its the right choice for the scope for a function call to be the same as the function definition. Having both use the same scope name overloads the "meaning" of Any thoughts? Is there another common scope name for a function call? |
Hi @binaryseed Here is the language grammar that is followed by most of the text editor and sublime included. But I do expect the themes to adapt well to elixir, and in that sense imo we should push themes to grow and have better token support them rather than removing the possibility to have them correctly identified by the text editors. |
Let’s see what other languages use for function calls and use the same
scope. It definitely shouldn’t use the same scope as function definitions
though. While I agree themes should evolve, I don’t think using Elixir is
common enough to put pressure on the themes to change. :)
--
*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*
|
Description
Add the pattern to scope the function calls with parenthesis or dot and
parenthesis. Allowing themes to change the color of function calls.
Outdated, please look the comment
Motivation
Currently the Elixir syntax does not support function calls and it simple does not evaluate a scope for it. This happens mainly because in Elixir you can call a function without the parenthesis, so variables and function can look the same.
In this context we have some considerations:
The compile raise a ambiguity warning
In Elixir community we that the quote "Explicit is better than implicit" so the compiler will warn the developer about a call that looks like a variable but actually is a function call.
The code formatter
By default it will add the parenthesis to ambiguous calls.
Ambiguous calls will stay exactly the same
Thats it, if you enjoy the ambiguous calls they will stay the same.