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

Discussion: ways to mitigate tuple module call removal #362

Closed
yrashk opened this issue Jun 10, 2012 · 0 comments
Closed

Discussion: ways to mitigate tuple module call removal #362

yrashk opened this issue Jun 10, 2012 · 0 comments

Comments

@yrashk
Copy link
Contributor

yrashk commented Jun 10, 2012

There's a chance that tuple module calls ({module, ...}:function(...)) will be eventually removed, and chances are they are not going to listen to my shouting on the erlang-questions mailing list (http://t.co/iwQdXMKI)

I would like to discuss how can we potentially mitigate this issue in the future development of Elixir, once (if) tuple module calls will be removed. Without having that established, a lot of code produced for Elixir will end up having such calls and the drop will have a major impact on Elixir's users.

I don't have a good solution yet, but I'll try by starting with some brainstorming.

Idea #1.

When generating code for variable.function, always insert a check into generated absforms (if it is an atom -> call with it, if it is a tuple, shuffle the arguments around).

Obviously, there would be a concern about performance. Here are few ideas to help mitigating those:

  1. Disable it by default. At least until tuple module calls are dropped in Erlang.
  2. SImilar to common lisp and alikes, allow some optimization directives. This could be used to instruct the compiler that the calls using variable X should be the above "dispatching calls" or not. No idea what kind of syntax should that be (something as stupid as "declare(x, atom)"? :-)
    2.1. Use type specifications to infer that instead. Solves the syntax & uniformity issue.

Idea #2.

Do nothing. Lets see how things will pan out

Thoughts?

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

2 participants