• 1 Post
  • 335 Comments
Joined 1 year ago
cake
Cake day: September 24th, 2023

help-circle





  • Yeah the main reason is performance. In some languages if you use a value “linearly” (i.e. there’s only ever one copy) then functional style updates can get transformed to mutable in-place updates under the hood, but usually it’s seen as a performance optimisation, whereas you often want a performance guarantee.

    Koka is kind of an exception, but even there they say:

    Note. FBIP is still active research. In particular we’d like to add ways to add annotations to ensure reuse is taking place.

    From that point of view it’s quite similar to tail recursion. It’s often viewed as an optional optimisation but often you want it to be guaranteed so some languages have a keyword like become to do that.

    Also it’s sometimes easier to write code that uses mutation. It doesn’t always make code icky and hard to debug. I’d say it’s more of a very mild code smell. A code musk, if you like.


  • I’ve tried to learn Vim in the past but IMO it is not worth it at all. In a world without multiple cursors… sure, maybe. With multiple cursors? No way. I can can edit just as fast as I’ve seen any Vim user do it, and without having to remember a gazillion mnemonics and deal with the silly modal thing.

    Multiple cursor editing even has some significant advantages over Vim style, e.g. it’s interactive, so you can do your edit gradually and go back if you make a mistake. Rather than having to write a complex command and only finding out it if works at the end. (If you’ve used regex find & replace you’ll understand that problem.)

    I’ll probably get downvoted for this since Vim is kind of a cult, and Vim users get a sense of superiority from it. Kind of like audiophiles - they don’t appreciate it if you tell them their £10k valve amp doesn’t actually sound any better than your £1k digital amp.

    For editing on remote computers I use VSCode remote or Micro for quick tasks.









  • I’m not sure I agree. I think most people can understand recipes or instruction lists and totally could program, if they wanted to and had to. They just don’t want to and usually don’t have to. They find it boring, tedious and it’s also increasingly inaccessible (e.g. JavaScript tooling is the classic example).

    But I think mainly people just don’t find it interesting. To understand this, think about law. You absolutely have the intellect to be a lawyer (you clever clog), so why aren’t you? For me, it’s mind-numbingly boring. If I was really into law and enjoyed decoding their unnecessarily obtuse language then I totally would be a lawyer. But I don’t.



  • You’ve essentially dissed people who use it for CI/CD and suggested that their pipeline is not robust because of their choice of using Bash at all.

    Yes, because that is precisely the case. It’s not a personal attack, it’s just a fact that Bash is not robust.

    You’re trying to argue that your cardboard bridge is perfectly robust and then getting offended that I don’t think you should let people drive over it.

    About shared libraries, many popular languages, Python being a pretty good example, do rely on these to get performance that would be really hard to get from their own interpreters / compilers, or if re-implementing it in the language would be pretty pointless given the existence of a shared library, which would be much better scrutinized, is audited, and is battle-tested. libcrypto is one example. Pandas depends on NumPy, which depends on, I believe, libblas and liblapack, both written in C, and I think one if not both of these offer a cli to get answers as well. libssh is depended upon by many programming languages with an ssh library (though there are also people who choose to implement their own libssh in their language of choice). Any vulnerabilities found in these shared libraries would affect all libraries that depend on them, regardless of the programming language you use.

    You mean “third party libraries” not “shared libraries”. But anyway, so what? I don’t see what that has to do with this conversation. Do your Bash scripts not use third party code? You can’t do a lot with pure Bash.

    If your temporary small script morphs into a monster and you’re still using bash, bash isn’t at fault. You and your team are.

    Well that’s why I don’t use Bash. I’m not blaming it for existing, I’m just saying it’s shit so I don’t use it.

    You could use Deno, but then my point stands. You have to write a function to handle the case where an env var isn’t provided, that’s boilerplate.

    Handling errors correctly is slightly more code (“boilerplate”) than letting everything break when something unexpected happens. I hope you aren’t trying to use that as a reason not to handle errors properly. In any case the extra boilerplate is… Deno.env.get("FOO"). Wow.

    What’s the syntax for mkdir? What’s it for mkdir -p? What about other options?

    await Deno.mkdir("foo");
    await Deno.mkdir("foo", { recursive: true });
    

    What’s the syntax for a dictionary in Bash? What about a list of lists of strings?




  • And I certainly am not proposing that we can abandon robustness.

    If you’re proposing Bash, then yes you are.

    You’ll probably hate this, but you can use set -u to catch unassigned variables.

    I actually didn’t know that, thanks for the hint! I am forced to use Bash occasionally due to misguided coworkers so this will help at least.

    But you can’t eliminate their dependence on shared libraries that many commands also use, and that’s what my point was about.

    Not sure what you mean here?

    Just want to copy some files around and maybe send it to an internal chat for regular reporting? I don’t see why not.

    Well if it’s just for a temporary hack and it doesn’t matter if it breaks then it’s probably fine. Not really what is implied by “production” though.

    Also even in that situation I wouldn’t use it for two reasons:

    1. “Temporary small script” tends to smoothly morph into “10k line monstrosity that the entire system depends on” with no chance for rewrites. It’s best to start in a language that can cope with it.
    2. It isn’t really any nicer to use Bash over something like Deno. Like… I don’t know why you ever would, given the choice. When you take bug fixing into account Bash is going to be slower and more painful.