4 ms·
What if I try to make a pipe with '|' or redirect the result with '>'? Should there be a warning for that? I find it amusing that people really do that though.
by oytis 7y ago
What if I try to make a pipe with '|' or redirect the result with '>'? Should there be a warning for that?
I find it amusing that people really do that though.
- sambe 7y agoSome people switch programming languages often. Exponentiation operators are common, both caret and double star are used. It does not seem amusing (surprising?) to me. On the other hand, piping and redirection are relatively uncommon outside of the shell. There is certainly a clearer mental distinction for me between "I am in shell" and "I am not in shell" than "I should double star".
- oytis 7y agoC doesn't have double star either (in fact double star means double dereferencing). YMMV or course, but distinction between a low-level language like C, and a higher-level one that can support exponentiation, matrix multiplication, thread spawning etc. as a first-class language construct is as clear to me as the difference between shell and non-shell.
- aidenn0 7y agoSomeone correct me if I'm wrong, but I believe double star as an infix operator would be interpreted as multiplication of a dereference: X ** Y would be parsed as X * (*Y)
- derefr 7y agoC has an “exponentiation operator”, used in literals where you’d expect exponentiation in other languages: <<. (Sure, it’s limited to raising things to powers of 2, but when would you ever need to raise something to a non-power-of-2? :P)
- deleted 7y ago[deleted]
- maxlybbert 7y agoThe warning amounts to “only someone who knows what they’re doing would write XXX, and we believe you don’t know what you’re doing.”