Skip to content

Discussion: ways to mitigate tuple module call removal #362

Closed
@yrashk

Description

@yrashk

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions