Hacker News new | ask | show | jobs
by andrenth 2541 days ago
I agree, but my point wasn't about the erlang module specifically. Maybe :ets would have been a better example.

At one point I suggested in the forums that, inspired by how Elixir understands [foo: bar] as equivalent to [{:foo, bar}], maybe it could allow foo:bar() as equivalent to :foo.bar(). That would make the syntax exactly like Erlang's, which would be pretty nice to signal "I'm calling an Erlang function here".

I still think it's a good idea, but it wasn't met with a lot of enthusiasm :)

1 comments

> I still think it's a good idea

Hm, it definitely looks like it. What arguments against it were raised?

IIRC the main one is that it could be confusing inside a list, e.g. [foo: bar] vs [foo:bar()]. Someone also mentioned that `foo. bar()` (with a space after the dot) is legal syntax, but `foo: bar()` wouldn't be.

I guess you can always do `alias :foo, as: Foo`.