Skip to content

Conversation

@michalmuskala
Copy link
Member

No description provided.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usual wording is something like

This function should not be used at runtime (see env/0 for more information).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is too much information because most of it is duplicated (from import_config/1 for example). I would say something like:

This function should not be used at runtime. Mix is a build tool and may not be available after the code is compiled (for example in a release).

To differentiate runtime behaviour depending on the environment, it's recommended to use application environment (see Application.get_env/3). Proper configuration can be set in Mix.Config files, often per-environment (see Mix.Config.import_config/1 for more information).

Wdyt?

@ericmj
Copy link
Member

ericmj commented Jul 8, 2017

I think we should rethink our use of "runtime" because it is perfectly fine to use Mix.env in tasks. When do tasks run if not at "runtime"?

@michalmuskala
Copy link
Member Author

What about something like this?

This function should not be used at runtime in application code (as opposed to infrastructure and build code like mix tasks)

@whatyouhide
Copy link
Member

This function should not be used at runtime in application code (as opposed to infrastructure and build code like mix tasks)

Sounds good to me (Mix capitalized and trailing period assumed 😄).

@michalmuskala
Copy link
Member Author

Updated

@whatyouhide whatyouhide merged commit 99effe3 into elixir-lang:master Jul 8, 2017
@whatyouhide
Copy link
Member

Thanks @michalmuskala! 💟

josevalim pushed a commit that referenced this pull request Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants