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

add conditionals into Nix Language Basics tutorial #1079

Closed
ellyxir opened this issue Nov 12, 2024 · 6 comments · Fixed by #1082
Closed

add conditionals into Nix Language Basics tutorial #1079

ellyxir opened this issue Nov 12, 2024 · 6 comments · Fixed by #1082
Labels
site Improvements to the site infrastructure or content presentation

Comments

@ellyxir
Copy link
Contributor

ellyxir commented Nov 12, 2024

Observations
After finishing the language basics, I thought about writing some basic code and realised that I didn't know how to use any conditionals. I thought maybe it was in the builtins but didn't see it there. Searching showed it was if in the Nix ref manual under Language constructs. Perhaps I missed it in the tutorial?

Problem
It feels like conditionals are a basic part of the language that I'd expect to know from a first pass tutorial. In fact, the tutorial touches on all language constructs except for conditionals and asserts. Perhaps comments also.

Approaches
Add conditionals to the language basics tutorial.

Willing to help?
I'm willing to help.

Priorities

Add 👍 to issues you find important.

@ellyxir ellyxir added the site Improvements to the site infrastructure or content presentation label Nov 12, 2024
@ellyxir ellyxir changed the title add conditions into Nix Language Basics tutorial add conditionals into Nix Language Basics tutorial Nov 12, 2024
@fricklerhandwerk
Copy link
Collaborator

fricklerhandwerk commented Nov 13, 2024

Yes, I originally made the decision to skip conditionals because there's really not much to say about them for the purpose of being able to read the language. In real-world code you rarely find if ... then ... else and when you do they're unsurprising. The purpose of the tutorial is to prepare people for what's unusual and special about the Nix language, and that taking enough time and space as it is made me conclude it's better to skip the parts that will be obvious for people experienced with software development (which is listed as the first prerequisite).

But since it's been brought up a couple of times now, I can imagine that maybe we mention it but still not go into detail to keep the noise down. What do you think about #1082?

@fricklerhandwerk
Copy link
Collaborator

btw, thanks a lot @ellyxir for bringing up these issues and making improvements! A lot of learners and new users will benefit from those, I'm sure. :)

@bew
Copy link
Contributor

bew commented Nov 13, 2024

What about having a section saying that conditionals are unsurprising, to at least mention it and give a simple example 🤔

Something that could be surprising tho' coming from imperative language is that the else ... branch is required.

@fricklerhandwerk
Copy link
Collaborator

Something that could be surprising tho' coming from imperative language is that the else ... branch is required.

Yeah that's true and probably worth mentioning. I'm still not sure if it's worth an entire section though, and if it is, where to put it. Feels weird to squeeze it somewhere randomly in between.

@ellyxir
Copy link
Contributor Author

ellyxir commented Nov 13, 2024

But since it's been brought up a couple of times now, I can imagine that maybe we mention it but still not go into detail to keep the noise down. What do you think about #1082?

That would have worked, I like that its near the beginning because I did a search for 'if' and it would have shown up early, thank you! Feel free to close this issue.

@fricklerhandwerk
Copy link
Collaborator

Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site Improvements to the site infrastructure or content presentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants