josevalim

josevalim

Creator of Elixir

Proposal: IEx hints

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)
‘\n\v\f’

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:

  1. Would such hints be generally helpful?

  2. 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.

Thank you.

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.

Most Liked

OvermindDL1

OvermindDL1

I’d personally think that would be greatly useful for new people yes.

OvermindDL1

OvermindDL1

Maybe instead of ‘default’ persistence it defaults to per-session, but at the bottom of each it says to run ‘some’ command to disable globally, which would add some kind of flag or so into the ~/.iex.exs or whatever file that disables globally.

I can very much see it being slightly irritating on new installs, but something like that would make it very easy to disable.

Neurofunk

Neurofunk

something great would be to be able to invoke a hint, independently of the context :slight_smile:

Where Next?

Popular in News Top

josevalim
Elixir v1.5.0-rc.0 has been released. This is a release candidate for the upcoming Elixir v1.5. It includes bug fixes, enhancements and ...
New
josevalim
Hi everyone, We are glad to announce that the second release candidate for Elixir v1.6.0 is out. Check out the CHANGELOG and give the r...
New
Elixir
Release: Release v1.9.2 · elixir-lang/elixir · GitHub 1. Enhancements Mix [mix release] Allow {:from_app, app_name} as a version for re...
New
Elixir
1. Bug fixes Elixir [bin/elixir] Properly handle the --dbg flag in Elixir’s CLI [Code.Formatter] Add brackets around keyword lists when ...
New
josevalim
Hi everyone, The next (and hopefully last) release candidate for Elixir v1.14 is out: Release v1.14.0-rc.1 · elixir-lang/elixir · GitHub...
New
whatyouhide
Hello folks, the Elixir team (well me, but I got a thumbs up from the others :P) is looking for contributors and potentially maintainers...
New
Elixir
Release: Release v1.10.3 · elixir-lang/elixir · GitHub 1. Bug fixes Elixir [Code] Return [{mod, bin}] from Code.compile_file/2, Code.re...
New
josevalim
Hi! :wave: I hope everyone is well! The Elixir team releases new versions every 6 months, typically every January and July. However, si...
New
Elixir
1. Enhancements Elixir [Protocol] Optimize protocol consolidation to no longer load structs 2. Bug fixes Elixir [Kernel] Fix unnecessa...
New
Elixir
This release requires Erlang/OTP 27+ and is compatible with Erlang/OTP 29. 1. Enhancements EEx [EEx] Optimize compiler by flattening ex...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement