Fish shell 3.0
181–190 of 227 posts
Re: Fish shell 3.0
#182Can anyone who's experienced with both fish and zsh comment on reasons fish might be better?
fish doesn't try to support all of the weird historical quirks of Bourne-style shells, so its grammar and built-in 'API' are far simpler and clearer. Its out-of-the-box configuration is much much nicer for most people than zsh's. Completion definitions are easier to read/write. Its source code seems less byzantine. And its GitHub-based development model is more accessible. The down side is that it's functionally very…
Re: Fish shell 3.0
#183Earlier quoted context omitted.
You just make ranges end-inclusive, and then it's x[1:10] + x[11:len(x)]. The best of both worlds is when a language provides both end-exclusive and end-inclusive slice syntax, as in e.g. Nim: x[0..<10] is end-exclusive, and it's very clear that it is.
But then you no longer get back 10-1 elements, you get back 10-1+1.
Half-open intervals are appropriate when you're thinking of them as subspaces of a continuum. When you're thinking of them as subsequences of discrete elements, closed intervals are usually more natural.
Ruby is the only language I know that really seems to have tried to address the problem, providing different syntax for every way you might want to take a subsequence from an array:
x[5..8] # elements [5] through [8], including [8]
x[5...9] # elements [5] through [9], excluding [9]
x[5, 4] # four elements, starting at [5]
If you were working in pure, pencil-and-paper mathematics, you'd choose whether to index a particular sequence from 0 or 1 based on what made your formula look nicer. Both are common. But that's not an approach I'd suggest for a programming language.Re: Fish shell 3.0
#184Earlier quoted context omitted.
What does someone want if they write "bar = print foo,"? Is it the same if "print" isn't the built-in function?
Operator precedence isn't really a new concept, and Python relies on it in plenty other situations: bar = 1 + 1 I do believe Python made the right call, actually: print needed to be unified with functions, and dropping the requirement for parenthesis for function calls would have introduced so much incompatibility as to make the Python 2 -> 3 transition far more difficult. But ignoring the legacy issue, there is a be…
Re: Fish shell 3.0
#185Earlier quoted context omitted.
fish doesn't try to support all of the weird historical quirks of Bourne-style shells, so its grammar and built-in 'API' are far simpler and clearer. Its out-of-the-box configuration is much much nicer for most people than zsh's. Completion definitions are easier to read/write. Its source code seems less byzantine. And its GitHub-based development model is more accessible. The down side is that it's functionally very…
Job control should be fully featured - backgrounding, stopping/continuing, and disowning are all implemented. If there's something missing we'd definitely look at adding it.
Re: Fish shell 3.0
#186Earlier quoted context omitted.
Finally! Fish 2.x shows you a message along the lines of "use `and` instead of `&&`", which is infuriating - it clearly knows what I want to do, and refuses to do it. I love fish and use it as my default shell, but I'm glad to see the fish team take a few steps towards bash compat.
That reminds me of the very specific nag messages I get from Python 3 when I don't write parens around parameters for print... do what I want already.
Re: Fish shell 3.0
#187How do people manage scripts to be used in such niche shells? I started using zsh at work recently, while I quite enjoy the shell experience it is a pain to rewrite all bash scripts to zsh or add lines of codes for compatibility. Any pointers?
Re: Fish shell 3.0
#188Earlier quoted context omitted.
Fish just uses (cmd), no $.
Ah, which I guess is why no subshell support?
(cd subdirectory && command --that might.fail) && run --command-in-original-dir --only-if-subshell-succeeded
... and expect to still be in the original dir when it's done. Any solution in Fish using "&& cd -" at the end of a block AFTER a maybe-failing command is just wrong, and there seriously isn't any way except saving and restoring $PWD every time you want subshell functionality, or using "; cd -" and manually saving the $status, which is equally as frustrating.There are some non-syntactic suggestions in https://github.com/fish-shell/fish-shell/issues/1439
Re: Fish shell 3.0
#189Apart from the other good stuff in this release, I think this will make a lot of things much easier: fish now supports && (like and), || (like or), and ! (like not), for better migration from POSIX-compliant shells
Re: Fish shell 3.0
#190How do people manage scripts to be used in such niche shells? I started using zsh at work recently, while I quite enjoy the shell experience it is a pain to rewrite all bash scripts to zsh or add lines of codes for compatibility. Any pointers?
You don’t. ;-) Use fish/zsh interactively, sh for simple scripts, Python for the more complex.