3 ms·
I think the lack of parentheses is whats throwing me off regularly with Elixir.
by sevenzero 4mo ago
I think the lack of parentheses is whats throwing me off regularly with Elixir.
- solid_fuel 4mo agoI find the optional parentheses, and the way that keyword lists are defined to be the two biggest stumbling blocks when I come back to Elixir after a while way. Coming from other languages, I find that example("with", 3, extra: "arguments", as: "a", keyword: "list") being equivalent to example("with", 3, [extra: "arguments", as: "a", keyword: "list"]) and example "with", 3, extra: "arguments", as: "a", keyword: "list" always takes some extra mental effort to get through, especially when there's no parenthesis. But I appreciate not having to write all the extra brackets and parens when I get going, so I think it's a fair tradeoff.
- arcanemachiner 4mo agoElixir has enough syntax sugar to cause diabetes. Personally, I like the flexibility, but yes there are a lot of rules to keep in mind.
- dqv 4mo agoone more ;) example("with", 3, [{:extra, "arguments"}, {:as, "a"}, {:keyword, "list"}]) iex> [{:extra, "arguments"}, {:as, "a"}, {:keyword, "list"}] = [extra: "arguments", as: "a", keyword: "list"] [extra: "arguments", as: "a", keyword: "list"]