Comment

Comment by denvaar

> Grouped aliases/imports/requires are a mis-feature in my view. They save a few characters when typing but they complicate searching for module uses and refactoring.

Totally agree with this. I prefer to not use aliases most of the time, or to explicitly list out each module path separately if they are too long to fit inline. All preferences though.

> Similarly, I don’t like comprehensions as everything they do can be achieved with functions, and they are not composable.

I don't use comprehensions too often, but I would miss them if they vanished. Some things are just plain easier with them. They are also valuable in unit tests to show better error messages[1]:

# Don't do... assert Enum.all?(posts, fn post -> %Post{} == post end)

# Do... for post <- posts, do: assert %Post{} == post

EDIT: Although I suppose you could just use Enum.each as well.

[1] https://keathley.io/blog/good-and-bad-elixir.html

parent denvaar 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton