In Elixir we are continuously trying to improve the experience for developers learning the language. However, there are still common road blocks users run into, despite of the tips and warnings put into the learning materials.
This proposal is about a hints mechanism for IEx that will allow us to print some information and guidance to users in common situations.
As an example, imagine the situation where IEx prints a list as a char list for the first time, a situation newcomers often find themselves in:
iex(1)> Enum.map([0, 1, 2], & &1 + 10)
In such cases, we could print hints, such as (don’t worry about the hint content for now):
Did you expect a different result than '\n\v\f'? By default Elixir prints a list of ascii characters in single quotes. Since [10, 11, 12] is a list of characters, you saw the '\n\v\f' result above. Whenever you are in IEx and you are not sure about what a data type means, use the `i/1` helper to give you more information: i('abc')
Each hint will be show only once. There will also be a function to disable all hints.
Before moving forward, the Elixir team has two questions:
Would such hints be generally helpful?
More importantly, which hints do you believe we could show on IEx? Hints should be valid language idioms that may be confusing when you first experience it. If an invalid construct is confusing, let’s say it has a poor error message, then we should improve the error message instead of adding a hint.
Please let us know when the hint should trigger and what we should suggest.
Note: This is an on-going discussion. Before joining the thread, please check the current discussion and see if your feedback and concerns haven’t already been brought up.