Adoption and iex -S mix

556 views
Skip to first unread message

Bruce Tate

unread,
Jan 22, 2015, 9:59:28 AM1/22/15
to elixir-l...@googlegroups.com
Is there some reason we don't make it easier to start iex with a default behavior? 

It's something that we all type hundreds of times a day, and something that beginners look up dozens of times, or more. This is the kind of tiny "secret club" barrier that plagued Erlang for years.

I realize there's a downside, but it would probably be worth it. 

Suggestions:

mix console
imix
iexmix

-bt

--
Bruce Tate
President, RapidRed, LLC
Phone: 512.772.4312
Fax: 512 857-0415

Author of Seven Languages in Seven Weeks, Deploying Rails Applications, From Java to Ruby, Rails: Up and Running, Beyond Java, 6 others.

José Valim

unread,
Jan 22, 2015, 10:15:46 AM1/22/15
to elixir-l...@googlegroups.com
Thanks Bruce!

* We could support "iex mix" but then I don't think it offers anything over iex -S mix (imo)

* We can't support "mix console" unfortunately. That was our first attempt but it doesn't work due to Erlang boot process

* "imix" and "iexmix" are valid alternatives, I am eager to see what people think



José Valim
Skype: jv.ptec
Founder and Lead Developer

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Josh Adams

unread,
Jan 22, 2015, 10:34:52 AM1/22/15
to elixir-l...@googlegroups.com
I very much remember "iex -S mix" being a secret incantation 17 months or so ago when I first learned of it.  It's old hat now but I still see people confused by it (hence the overbearing chatbot mentions of it).  imix and iexmix both make my face curl up funny but I feel like my familiarity with `iex -S mix` has somehow made my opinion on the matter invalid at this point :)
--
Josh Adams

Peter Hamilton

unread,
Jan 22, 2015, 1:41:09 PM1/22/15
to elixir-l...@googlegroups.com
What are parallels in other ecosystems?

Ruby: bundle exec irb

mix exec iex maybe?

greggreg

unread,
Jan 23, 2015, 5:38:22 AM1/23/15
to elixir-l...@googlegroups.com, jose....@plataformatec.com.br
Why is the -S capitol? The other options are lowercase and -s isn't taken.

José Valim

unread,
Jan 23, 2015, 5:52:19 AM1/23/15
to elixir-l...@googlegroups.com
It is because everything after -S is taken as the new script to run. So it behaves differently than the other options.



José Valim
Skype: jv.ptec
Founder and Lead Developer

Joshua Nussbaum

unread,
Jan 23, 2015, 2:28:12 PM1/23/15
to elixir-l...@googlegroups.com, jose....@plataformatec.com.br
What about just typing `iex` and then iex could check if there's a mix.exs in current working dir?
and then `iex --no-mix` to run bare

Steve Domin

unread,
Jan 23, 2015, 2:39:27 PM1/23/15
to elixir-l...@googlegroups.com, jose....@plataformatec.com.br
Same question as Joshua.

Since it's breaking the current behaviour I imagine it's not that simple but it sounds like a good idea.

Bryan Joseph

unread,
Jan 23, 2015, 3:02:34 PM1/23/15
to elixir-l...@googlegroups.com
I do like Joshua's suggestion as well, but there is something nice about "iex -S mix". It's explicit that you are running the interpreter using the current environment. If there is going to be a change I support "iex mix". It might not be much better than "iex -S mix", but it still makes it clear what you are doing.

Steve Domin wrote:

Same question as Joshua.

Since it's breaking the current behaviour I imagine it's not that
simple but it sounds like a good idea.

On Friday, 23 January 2015 19:28:12 UTC, Joshua Nussbaum wrote:

    What about just typing `iex` and then iex could check if there's a
    mix.exs in current working dir?
    and then `iex --no-mix` to run bare

    On Friday, 23 January 2015 05:52:19 UTC-5, José Valim wrote:

        It is because everything after -S is taken as the new script
        to run. So it behaves differently than the other options.



        *José Valim*
        www.plataformatec.com.br <http://www.plataformatec.com.br/>

        Skype: jv.ptec
        Founder and Lead Developer

        On Fri, Jan 23, 2015 at 11:38 AM, greggreg <greg...@gmail.com>
        wrote:

            Why is the -S capitol? The other options are lowercase and
            -s isn't taken.


            On Thursday, January 22, 2015 at 7:15:46 AM UTC-8, José
            Valim wrote:

                Thanks Bruce!

                * We could support "iex mix" but then I don't think it
                offers anything over iex -S mix (imo)

                * We can't support "mix console" unfortunately. That
                was our first attempt but it doesn't work due to
                Erlang boot process

                * "imix" and "iexmix" are valid alternatives, I am
                eager to see what people think



                *José Valim*
                www.plataformatec.com.br
                <http://www.plataformatec.com.br/>
                    elixir-lang-co...@__googlegroups.com.
                    For more options, visit
                    https://groups.google.com/d/__optout
                    <https://groups.google.com/d/optout>.



            --
            You received this message because you are subscribed to
            the Google Groups "elixir-lang-core" group.
            To unsubscribe from this group and stop receiving emails
            from it, send an email to elixir-lang-co...@googlegroups.com.
            For more options, visit https://groups.google.com/d/optout
            <https://groups.google.com/d/optout>.



--
You received this message because you are subscribed to the Google
Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elixir-lang-co...@googlegroups.com

Heri Sim

unread,
Jan 24, 2015, 12:44:33 PM1/24/15
to elixir-l...@googlegroups.com
Convention over tiresome command-line flags is better. If mix.exs is present, Iex should start up with a warning saying "Mix was autoloaded from the current directory. Use the --no-mix flag to turn off mix autoloading." or simply just cd .. to get out of the current mix project directory. How many times do you use "iex -S mix" vs just plain "iex"? Let's be realistic and make it less painful for every beginner.

her...@gmail.com

unread,
Jan 24, 2015, 10:52:17 PM1/24/15
to elixir-l...@googlegroups.com
‎After thinking about it overnight,

I feel "mixi" would be better. It would be a simple symbolic link to iex, and iex would detect that it has been called using "mixi" by checking the first system argument. This multimode symlink technique is commonly used ‎in the Unix (e.g. busybox applets) and Go-lang (e.g. zerotier-idtool) community.

This is cleaner semantically, as "mix" would be the basename for all commands related to mix. If iex means "interactive elixir", Mixi means "load mix in interactive elixir".


  元のメッセージ  
送信者: Heri Sim
送信: Sunday, 25 January, 2015 00:44
To: elixir-l...@googlegroups.com
返信先: elixir-l...@googlegroups.com
件名: Re: [elixir-core:3858] Adoption and iex -S mix

Convention over tiresome command-line flags is better. If mix.exs is present, Iex should start up with a warning saying "Mix was autoloaded from the current directory. Use the --no-mix flag to turn off mix autoloading." or simply just cd .. to get out of the current mix project directory. How many times do you use "iex -S mix" vs just plain "iex"? Let's be realistic and make it less painful for every beginner.

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/cLCbsAhR7uo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexei Sholik

unread,
Jan 25, 2015, 8:54:42 PM1/25/15
to elixir-lang-core
One addition to the above is that with "mixi" there will be one more thing for people to learn (not just beginners). For example, what will the following invocation look like?

  iex -S mix run --no-halt --erl "..."

If it remains as is, then we should expect as many questions asking about configuring the specifics of launching "mixi" as we are getting about running a Mix project in IEx now (note that "mix help" mentions "iex -S mix", so we shouldn't expect that documenting "mixi" will help with reducing the potential for questioning).

If we change it to something like

  mixi run --no-halt --erl "..."

then we'll have two commands that parallel each other's arguments (mix and mixi) because in general someone may also want to execute "mixi test" and other commands.


I like the idea of IEx checking for the presence of mix.exs in the current directory. This could be made configurable via ~/.iex.exs:

  IEx.configure autoload_mix_project: true|false

This approach will help reduce typing, but it won't reduce the number of questions. iex will still have to support the -S flag for additional configuration of the mix task to run.

You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.

Steve Domin

unread,
Jan 26, 2015, 6:10:03 AM1/26/15
to elixir-l...@googlegroups.com
I'm not a huge fan of introducing a new command, it seems to be defeating the purpose of this thread in the first place.

Gage Peterson

unread,
Jan 29, 2015, 1:57:53 AM1/29/15
to elixir-l...@googlegroups.com
Talking as a beginner, I did `mix -h` and found it quite easily. I thought "That's weird" and then that was the end of my confusion. Now it's perfectly normal for me. Maybe `iex mix` would be slightly nicer but only in a 2 character way, (although probably a lot more memorable) Here's an interesting suggestion. if you really wanted `mix console` couldn't you just use `System.cmd` (http://elixir-lang.org/docs/stable/elixir/System.html#cmd/3) to run iex as it now stands.

Tallak Tveide

unread,
Jan 29, 2015, 11:43:01 AM1/29/15
to elixir-l...@googlegroups.com
I can't remember this actually being an issue for me. After the first tutorial I always just wrote it out. I never really understood exactly why the command looks like it does (I guess after reading this it is clearer), but I think actually keeping a logical seperation of the iex tool and the script in mix.exs is a good thing. So I would vote for keeping the existing invocation.

Lau Taarnskov

unread,
Feb 4, 2015, 2:20:23 PM2/4/15
to elixir-l...@googlegroups.com
I think this is a great idea. Another vote for "iex" being the equivalent of "iex -S mix" if mix.exs is present. And the warning is a good idea too.

This way we are not adding any new commands. It is simply making a reasonable behavior the default.

Are there any good reason not to do this?

On Sat, Jan 24, 2015 at 3:44 PM, Heri Sim <her...@gmail.com> wrote:
Convention over tiresome command-line flags is better. If mix.exs is present, Iex should start up with a warning saying "Mix was autoloaded from the current directory. Use the --no-mix flag to turn off mix autoloading." or simply just cd .. to get out of the current mix project directory. How many times do you use "iex -S mix" vs just plain "iex"? Let's be realistic and make it less painful for every beginner.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gabriel Jaldon

unread,
Feb 7, 2015, 1:35:51 AM2/7/15
to elixir-l...@googlegroups.com
I like the idea of IEx checking for the presence of mix.exs in the current directory. This could be made configurable via ~/.iex.exs:

I like the above suggestion of making iex configure via `~/.iex.ex` or whatever filename is suitable. From there we could also load all useful helpers like `alias App.User`, etc.. when loading the iex console. That'd be really helpful.

Default behaviour for IEx loading mix environment if mix.exs exists in the current directory +1! A warning/information message would suffice to inform user that the Mix env is loading.

Jon Parise

unread,
Feb 7, 2015, 2:53:50 PM2/7/15
to elixir-l...@googlegroups.com
I like the above suggestion of making iex configure via `~/.iex.ex` or whatever filename is suitable. From there we could also load all useful helpers like `alias App.User`, etc.. when loading the iex console. That'd be really helpful.

You can already configure IEx via the .iex.exs file (http://elixir-lang.org/docs/master/iex/IEx.html).

Gabriel Jaldon

unread,
Feb 9, 2015, 7:18:28 AM2/9/15
to elixir-l...@googlegroups.com
Thanks for the info, Jon! Didn't realize that was available!

On Sun, Feb 8, 2015 at 3:53 AM, 'Jon Parise' via elixir-lang-core <elixir-l...@googlegroups.com> wrote:
I like the above suggestion of making iex configure via `~/.iex.ex` or whatever filename is suitable. From there we could also load all useful helpers like `alias App.User`, etc.. when loading the iex console. That'd be really helpful.

You can already configure IEx via the .iex.exs file (http://elixir-lang.org/docs/master/iex/IEx.html).

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/cLCbsAhR7uo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CADN-ebir7_oP9TPkBu-3dc8hLxQU16DkXrrx1PROdw3cPQQo_Q%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Gabe Jaldon

V Ta

unread,
Mar 18, 2015, 9:01:28 AM3/18/15
to elixir-l...@googlegroups.com, jose....@plataformatec.com.br
i have
alias imi='iex -S mix'
in my .bashrc)))

четверг, 22 января 2015 г., 16:15:46 UTC+1 пользователь José Valim написал:

Luke Imhoff

unread,
Mar 19, 2015, 9:27:35 PM3/19/15
to elixir-l...@googlegroups.com
 
Ruby: bundle exec irb


If you install with rvm, `bundle exec` is automatic, so just `irb` works.  If you're not using rvm, `bundle console` works for irb with the bundle loaded, so that would be `mix console` for Elixir.

 

Paul Smith

unread,
Mar 20, 2015, 11:41:34 AM3/20/15
to elixir-l...@googlegroups.com
I totally agree that it's tricky at first. When I first started a couple months ago I had to often look this up with `mix -h`. Auto detecting `mix.exs` sounds like a great idea. It would be great to output a message that says "Autoloaded mix.exs, run ex --no-mix" or whatever the option would be.

I'm just imagining a beginner creating a new Phoenix project and typing `iex` and it just works, with a helpful message telling them how to run without the default. That would be really great I think.
Reply all
Reply to author
Forward
0 new messages