Skip to content

Special variables comparisons #1867

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

Closed

Conversation

NotTheDr01ds
Copy link
Contributor

At @132ikl's suggestion in #1860, I've added a few comparisons to other languages. I've done this as a VuePress Tab rather thana table so that we can use language-highlighting/code-blocks.

@132ikl - What do you think about this format?

@132ikl
Copy link
Member

132ikl commented Apr 8, 2025

I'm not sure if the reduced ctrl-f-ability is made up for by a little syntax highlighting. The only one where the syntax highlighting does anything significant is the $env example. It would be difficult to find something like the equivalent to $0 since you can't ctrl-f for $0, so people might have to actual read through/scroll through in order to find what they're looking for. Not totally sure the best way to handle it is

@NotTheDr01ds
Copy link
Contributor Author

Right - The Ctrl+F searchability is a problem, but I think most folks would figure that out from the index at the beginning.

The bigger problem, with either a table or tabs (but more so with a table) is that there's just no "1-for-1 mapping" in these.

For instance, $0 in Bash is not the same as any of our constructs.

In Bash:

  • $0 in a source file will report the path to the interpreter.
  • But running as a script works similar to our $env.PROCESS_PATH:
  • And to add insult to injury, there's BASH_SOURCE (non-POSIX) which is an array where BASH_SOURCE[0] is closest to our PROCESS_PATH in both source and scripts.

Of course, we don't use an array to show the PROCESS_PATH when there's a parent caller (or callers) like BASH_SOURCE, but we probably should. But that means that neither ?0 nor BASH_SOURCE have a direct equivalent in Nushell.

PowerShell is equally incongruous to Nushell in these constructs.

And, for that reason, I think I'm going to give up trying to actually document this in any "succinct" form :-)

@fdncred
Copy link
Contributor

fdncred commented Apr 9, 2025

I would've voted to just land it as a table or tabs. Some is better than none. Perfection is too high of a goal. Now, more people lose because this isn't there at all.

@NotTheDr01ds
Copy link
Contributor Author

@fdncred I closed it because what I had in here was just wrong in most respects and, regardless, needs a fresh start.

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.

3 participants