josevalim
Call to library authors: define "Nutrition facts" for your meta-programming
One common concern about using Elixir libraries is that use SomeModule does not make clear how it impacts the caller. While the goal of use is precisely to provide a common extension point, and most of the time those changes are minor, it is impossible to know what it does without reading the source code.
For this reason, from Elixir v1.15, we are recommending libraries to include a summary alongside each module, typically within the first section of its @moduledoc, that succinctly explains the impact of using said modules. In this pull request, we have added this note to all use XYZ modules in stdlib, like this:
> #### `use GenServer` {: .info}
>
> When you `use GenServer`, the GenServer module will
> set `@behaviour GenServer` and define a `child_spec/1`
> function, so your module can be used as a child
> in a supervision tree.
Which will be rendered like this (see block at the bottom):
Think of it as “Nutrition facts” for meta-programming. If you are a library author and your modules can be used, please consider doing the same. ![]()
Most Liked
sodapopcan
With careful consideration, use beneficially cleans up a lot of noise and I’m glad it exists.
(•_•) even if it is a bit
( ••)>⌐■-■
(⌐■■) overused
Sorry, I couldn’t resist. I’ll see myself out.
kip
Good idea. I’ll update the ex_cldr libs over the next week or so.
Update: added to the ex_cldr README and the Cldr module and published to hex.pm.
fceruti
On a somewhat related note, a cool feature available on neovim using elixir-tools, is the expand macro:

Popular in Notices
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









