syklemil

joined 2 months ago
[–] [email protected] 11 points 1 month ago (6 children)
#!/bin/bash
set -euo pipefail

if [[ -z "${1:-}" ]]
then
  echo "we need an argument!" >&2
  exit 1
fi
[–] [email protected] 4 points 1 month ago

This just looks like the average Norwegian

[–] [email protected] 5 points 1 month ago

I'd interpret vertical content growth as content per area, deep story lines, stuff like that. It's a common enough comment, see e.g. MMO players complaining about "content drought".

[–] [email protected] 7 points 1 month ago (2 children)

I think I mentioned it, but inverse: The only data type I'm comfortable with in bash are simple string scalars; plus some simple integer handling I suppose. Once I have to think about stuff like "${foo[@]}" and the like I feel like I should've switched languages already.

Plus I rarely actually want arrays, it's way more likely I want something in the shape of

@dataclass(frozen=True)
class Foo:
    # …

foos: set[Foo] = …
[–] [email protected] 1 points 1 month ago (1 children)

-e is great until there’s a command that you want to allow to fail in some scenario.

Yeah, I sometimes do

set +e
do_stuff
set -e

It's sort of the bash equivalent of a

try { 
  do_stuff()
} 
catch { 
  /* intentionally bare catch for any exception and error */
  /* usually a noop, but you could try some stuff with if and $? */ 
}

I know OP is talking about bash specifically but pipefail isn’t portable and I’m not always on a system with bash installed.

Yeah, I'm happy I don't really have to deal with that. My worst-case is having to ship to some developer machines running macos which has bash from the stone ages, but I can still do stuff like rely on [[ rather than have to deal with [ . I don't have a particular fondness for using bash as anything but a sort of config file (with export SETTING1=... etc) and some light handling of other applications, but I have even less fondness for POSIX sh. At that point I'm liable to rewrite it in Python, or if that's not availaible in a user-friendly manner either, build a small static binary.

[–] [email protected] 4 points 1 month ago

The logs are handled, but I mostly use it for command separation and control, including killing unruly child processes.

[–] [email protected] 13 points 1 month ago (5 children)

At the level you're describing it's fine. Preferably use shellcheck and set -euo pipefail to make it more normal.

But once I have any of:

  • nested control structures, or
  • multiple functions, or
  • have to think about handling anything else than simple strings that other programs manipulate (including thinking about bash arrays or IFS), or
  • bash scoping,
  • producing my own formatted logs at different log levels,

I'm on to Python or something else. It's better to get off bash before you have to juggle complexity in it.

[–] [email protected] 3 points 1 month ago

There also are some stories from js devs about how async/await reduced the spaghetti factor of their code a lot. So yeah, similar stories all around I think, even though async/await obviously isn't a magical thing with no downsides

[–] [email protected] 3 points 1 month ago

Yes, I agree. It appears to have worked on the leftpondians though, and thus we get headlines like this.

[–] [email protected] 2 points 1 month ago* (last edited 1 month ago)

Yeah, Rust is ultimately a different project than Go, and I suspect much of the success of Go is down to stuff like good tooling, default GC, native static binaries, generally easy concurrency, rather than stuff like having as bare-bones a language as otherwise possible. I'd suspect having a focus on fast compilation also helps draw in people from interpreted languages.

It's easy to write a Kubernetes microservice that performs adequately with Go, and that's all a lot of people & teams need.

[–] [email protected] 4 points 1 month ago* (last edited 1 month ago) (3 children)

Yeah, the Go creators seem to generally mean "resembles C" when they use words like "simple", which could explain stuff like going "why do you need generics when you can just cast?" for, what, ten years?

I remember trying some Plan9 stuff and bouncing off it, including acme. I guess it's the kind of thing that makes sense to Pike but not to me. Not sure what gophers in general think of it (but wikipedia lists at least Russ Cox as a user).

[–] [email protected] 3 points 1 month ago (2 children)

That's my opinion as well (I think of "ebike" as "EU-conformant pedelec"), but that opinion doesn't seem to be universal.

view more: ‹ prev next ›