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

Link from 'TiN -> Immutable Variables' to Variables chapter to reduce redundancy #1439

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

NotTheDr01ds
Copy link
Contributor

I noticed that the "Thinking in Nu" chapter still had a section discussing the fact that "Variables are immutable" even though we've had mut for some time now.

There's still some useful information in here, as the default should be to use immutables, but it's no longer a "Common surprise" that we don't have mutables.

I've reworded and moved this content to the "Variables" chapter in the Book. I've also consolidated some other info I wrote up in the Language Ref that better fits here.

@fdncred
Copy link
Collaborator

fdncred commented Jun 7, 2024

It looks to me like all the info in thinking_in_nu.md is still valid but could be clarified by saying, "... from other languages is that Nushell let variables are immutable" and somewhere else we could say mut variables are mutable.

@NotTheDr01ds
Copy link
Contributor Author

Fair - I was reading it with my "historical" glasses on and the realization that, at the time it was written, we didn't have mut at all (or for/while and others that need mutable variables). It just reads "oddly" to me a bit since it seems to imply that we still don't have mutable variables at all.

It also seemed to me that "Thinking in Nu"* was focused on things that might completely trip up users who were used to doing things a different way. While it's still "best practice" to use immutability in Nushell, it's no longer required.

That said, perhaps it is such an important best practice that it still belongs in the "front matter" (Getting Started -> Thinking in Nu)?

I'll move it back and work on a few tweaks to make it "cleaner".

Any objection to me shortening up the "Thinking in Nu -> Variables are immutable by default" section by making it an "overview" with the detail still in the Variables chapter?

@NotTheDr01ds NotTheDr01ds changed the title Removed outdated info on immutable variables. Consolidated remaining. Link from 'TiN -> Immutable Variables' to Variables chapter to reduce redundancy Jun 7, 2024
@fdncred
Copy link
Collaborator

fdncred commented Jun 8, 2024

at the time it was written, we didn't have mut at all

yup, 100% right. it hasn't aged terribly well.

One thing that still fits but may not be talked about much are the things like how it's related more closely to a compiled language like why we have env.nu and config.nu although some of that has changed too because we now have const and we have a growing set of commands that are const. Maybe this is what I'm thinking about too https://www.nushell.sh/book/how_nushell_code_gets_run.html.

Any objection to me shortening up the "Thinking in Nu -> Variables are immutable by default" section by making it an "overview" with the detail still in the Variables chapter?

probably not

@NotTheDr01ds
Copy link
Contributor Author

Maybe this is what I'm thinking about too

Yup - Given that there are links in both directions (from TiN <-> "How Nushell code gets run"), I think it's up-to-date. And I'm still grokking it a year after first reading it ;-)

As for the Immutable Variables, I refactored it so that the "core concept" is still in "Thinking in Nu" but consolidated the rest of the info and examples into the "Variables" chapter. Let me know if that revision looks okay to you.

@fdncred
Copy link
Collaborator

fdncred commented Jun 13, 2024

let's move forward with this one and the cookbook one. thanks

@fdncred fdncred merged commit 0940bab into nushell:main Jun 13, 2024
2 checks passed
@NotTheDr01ds NotTheDr01ds deleted the no-longer-immutable-only branch June 17, 2024 17:36
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 this pull request may close these issues.

None yet

2 participants