fish now supports && (like and), || (like or), and ! (like not), for better migration from POSIX-compliant shells
fish now supports && (like and), || (like or), and ! (like not), for better migration from POSIX-compliant shells
Perhaps the language creators have plans for future syntax that would not allow what you want. Even if for now the language evidently knows what you mean from the error message.
In this specific case, the developers of fish apparently decided && was good to add.
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 better way to do function calls, and it is ruby.
f 1 2
(f 1 2).thing
Here the parentheses are nothing special, they just hint precedence.As opposed to
f 1, 2
f(1, 2).thing
Awkward special-case commas and parentheses.C style function calls are common, explicit, and consistent. Python adds the best combination of positional, variadic, and named parameters of any language I know. ML style has less punctuation and simpler grouping rules. Ruby has the weaknesses of both.
What does someone want "print (1, 2)" to do if "print" is the built-in function? It prints a tuple in Python 2 and ints in Python 3.
If I say "print 'foo'" though, it recommends "print ('foo')", but doesn't go all the way to assume I actually meant that. There's a piece of code handling that special case that stops short of actually interpreting what I apparently mean.
The frustration around that was the original point.
I take it fish didn't / doesn't support either?
(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
You were still running the old version, and `echo $version` would have told you.
But maybe now it’s getting closer to production readiness.
The syntax is different, the semantics are the same.
I think it's called POSIX.
But calling it "getting closer to production readiness" feels a tad insulting.
It's probably just a bit of snark, so it's not worth getting up in arms about, but it's not really friendly phrasing.