Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default to auto-install hooks on *nix #5401

Closed
jonahbeckford opened this issue Dec 22, 2022 · 2 comments · Fixed by #5456
Closed

Change default to auto-install hooks on *nix #5401

jonahbeckford opened this issue Dec 22, 2022 · 2 comments · Fixed by #5456

Comments

@jonahbeckford
Copy link
Contributor

This is an issue filed in response to:

  1. https://discuss.ocaml.org/t/what-are-the-biggest-reasons-newcomers-give-up-on-ocaml/10958/13?u=jbeckford

    Explaining the need for eval $(opam env) or the equivalent on Windows.

  2. https://discuss.ocaml.org/t/what-are-the-biggest-reasons-newcomers-give-up-on-ocaml/10958/136?u=jbeckford

    eval $(opam env) is incomprehensible for students (and actually often needed)

As rightly pointed out in https://discuss.ocaml.org/t/what-are-the-biggest-reasons-newcomers-give-up-on-ocaml/10958/23?u=jbeckford, users are given the option to not do eval $(opam env):

Do you want opam to configure bash?
  1. Yes, update ~/.profile
  2. Yes, but don't setup any hooks. You'll have to run eval $(opam env) whenever you change your current 'opam switch'
  3. Select a different shell
  4. Specify another config file to update instead
> 5. No, I'll remember to run eval $(opam env) when I need opam

[1/2/3/4/5] 5

The real problem is that anyone new to Opam:

  • will not know what eval $(opam env) does
  • will not recognize how often they will need to type eval $(opam env)
  • will not be able to mentally connect a command not found from the Bash/Zsh shell with eval $(opam env)

In fact, this isn't even an Opam thing. I suspect less than 25% of *nix devs understand what the POSIX shell form eval $(...) actually does.


From what I've observed, newcomers just pick the default because they do not understand the magic syntax, and also because they have prior expectations that "default" will be right for a newcomer.

Can we switch the default to 1. Yes, update ~/.profile?

@dra27
Copy link
Member

dra27 commented Jan 5, 2023

I agree with this. The "fear" in the past has been breaking things and then being "yelled" at by power users grumbling that opam changed global things without being explicitly told to - I think that's fair, @AltGr? 🙂

Especially now that it's down to just one question with the menu, I think it's safe for the default to be the least surprising for new users - a "power" user who sits on enter without reading the prompt possibly deserves what's coming to them?! 🙈

@dra27
Copy link
Member

dra27 commented Jan 6, 2023

A couple of other suggestions from today to make this even clearer:

  • The comments added to .profile (or whatever gets updated) could be made even more explicit about what can be deleted (e.g. putting a lowerline comment) and also make it clear that they can be safely deleted at anytime and give the command to re-add them.
  • opam init after updating the file could be even more explicit about exactly where the file was updated - e.g. "added three lines after L56 in ~/.profile", etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants