5 ms·
Look, I'm generally with you, there isn't anything particularly bad about modern JavaSscript, and it's a perfectly fine language to write your tools in if that'
by chaosite 7y ago
Look, I'm generally with you, there isn't anything particularly bad about modern JavaSscript, and it's a perfectly fine language to write your tools in if that's what you like.
But your points are... Weird.
1. Familiar to people who know JavaScript, sure. But shell is the language you interact with the CLI with, so more people who use the CLI are familiar with a shell.
2. Most languages have a standard library.
3. I know many people who would disagree with you. Anyway, pip works fine in a Unix environment, which is what we're discussing here.
4. We're talking about glue code, right? Glue doesn't tend to be very parallel.
5. So, perfect Unix glue? Sure, you like it, and that's great for you! Keep on doing you. It's obviously capable of making nice tools, but so are most languages...
6. You luks-suspend example is weird because the Node.js code obviously does so much less than the other versions. I have no idea what the Go version is doing, but the shell version does things like remount the filesystem, handle udev, etc... A bash version of the JavaScript code would be shorter!
7. 0.1+0.2!=0.3 is a result of floating point arithmetic being floating point arithmetic. It's not specific to JavaScript.
- w56rjrtyu6ru 7y ago1. Most people who interact with a shell know how to make it run one command with arguments; some eventually learn about IO redirection. Many such people who use Bash as a "command prompt" would find the way it does even simple things like variables and conditionals exceedingly arcane. Readability is important, and, for better or worse, a compact curly bracket syntax is seen as "the norm". 2. Different languages' standard libraries have different scopes. Node's is just right for the task at hand. 3. I know many people who disagree with me, too. That doesn't make me wrong (or right ;-)). 4. Why not? Doing a task and displaying a rich progress indicator is doing two tasks. Glue is a continuum - for me, the concept includes orchestration of external "heavy lifting" tasks according to the desired logic, as well as processing intermediary outputs in simple ways so the whole pipeline fits together. 5. Well, I've evaluated it and found it to my liking. I guess you grow to like the tools you use to accomplish things, and if everyone who went out of their way to publicly dismiss Node.js instead went out of their way to use it in place of Bash scripting, they might find it to their liking as well. 6. Yet ironically, it has been the most reliable in achieving its purpose of locking my encrypted partitions when my computer goes to sleep, not to mention unlocking them when I wake it up. 7. Exactly - but people keep pulling this and other quirks out of their ass as "proof" JavaScript is some horrible language. Show me a shell scripting language that even has floating point arithmetic! But maybe glue code can't ever need that, either?
- hnlmorg 7y ago> Readability is important, and, for better or worse, a compact curly bracket syntax is seen as "the norm". Python seems pretty popular. > I know many people who disagree with me, too. That doesn't make me wrong The problem isn't that you're saying node is well suited. The problem was your suggestion that node was uniquely well suited when actually the CLI is a solved problem in most languages. > Well, I've evaluated it and found it to my liking. That's all that really matters when it comes to your own personal usage. Just don't expect everyone to have those same preferences nor argue with other developers that your preferences are any kind of "fact". > I guess you grow to like the tools you use to accomplish things, and if everyone who went out of their way to publicly dismiss Node.js instead went out of their way to use it in place of Bash scripting, they might find it to their liking as well. Personally I don't like node and find Bash easier however it's thankfully not an "either/or" argument where your only options are Javascript or Bash. There's a whole plethora of options out there. > Yet ironically, it has been the most reliable in achieving its purpose of locking my encrypted partitions when my computer goes to sleep, not to mention unlocking them when I wake it up. That's a pretty meaningless anecdote because it could be the result of a whole plethora of reasons outside of the language's control (including but not limited to user error) or even completely made up (like your point about floating point arithmetic (see below) or your other comment about one liners being more readable than multi-lined code). > Show me a shell scripting language that even has floating point arithmetic! Quite a few do: ksh93, yash, zsh and murex (disclaimer: I wrote that shell) are all interactive shells which support floating point arithmetic. In terms of shell scripting languages, you can add the following to the above group: awk, bc, dc and perl. Even those shells that don't support floating point arithmetic can still do pseudo floating point maths by using powers of 10 multipliers and printf to place the decimal point: printf %.10f\\n "$((1000000000 * 365/7))e-9" Ok, I'll grant you that is rather ugly. Thankfully you can call other shell scripting languages from within your POSIX/C shell: bc <<< "scale=10; 365/7" This isn't a hard thing to research either; which suggests to me you haven't done your homework before making your arguments.
- deleted 7y ago[deleted]
- 7y ago