3 ms·
Ahh, you edited significantly while I was replying. Here goes to your current message: > [...] you ask "Why would I ever want to calculate a cosine in a bash
by civility 7y ago
Ahh, you edited significantly while I was replying. Here goes to your current message:
> [...] you ask "Why would I ever want to calculate a cosine in a bash script?"
I wouldn't ask that. This kind of argument strategy is silly too. You should choose your own words, and I'll choose mine. Leave the fake dialogs to Aristotle.
> To illustrate my point: Perhaps you want to write a script that draws a pie chart to illustrate your disk space. With bash, you'd have to call out to another language to do that. Why is that? Tell me why hasn't anyone come up with a way to draw like the canvas API in bash, without forking off dozens if not thousands of processes? Don't you think that would be useful?
I routinely use gnuplot as plotter in a child process. This works with bash, python, C++, or any other language which supports popen (that's fork, dup, and exec).
> Because bash can't even perform the simplest APPLESOFT BASIC floating point math operations [...]
I'm not defending bash. I'm saying that putting Python much ahead of it is silly. Why would you want to run a race with either a snail or a turtle? Silly parables about the tortoise and the hare aside, pick a cheetah or something.
> And of course needlessly converting all those numbers back and forth between strings and floating point so many times.
Python tediously checks if the vtable contains the necessary operator, evaluates the function pointer it finds, which checks the other operand's type, unpacks the 8 bytes of doubles from each 32 byte struct, finally performs the operation, then allocates a new 32 byte structure for the return result, which is checked to see if an exception occurred, and then pushed onto the stack. I probably missed some steps, and I certainly ignored the sophomore level interpreter loop overhead.
I mean, yeah that's faster than fork, but I'm not sure it's a huge win over anything else.