News for hackers. Stuff that matters.
Re:Shell Style Guide by coldtea on Tuesday May 15, 2018 @10:38AM (#17074214)
>Python seems to handle complexity better, but only on the surface. (Basically Python has nice data structures, great string formatting, and .. that's it.)

It's a complete scripting language, with tons of features, from a comprehensive standard library with something for most needs, to a packaging system, isolated environments, async io, and more. And lots of expressivity in structuring your program (including optional types).

So, not sure what the above "and that's it" means. That it's not Haskell? Yes, it's not.

>Setting up the Python environment requires something, because Python comes in many flavors (2 vs 3, system installed, user installed, /usr/local) and there are a bunch of factors (pip, pyenv, pipenv, PYTHONPATH, current directory with modules, requirement for python-dev headers, and GCC to compile native parts of packages, and then of course maybe extra shared libraries too) that can affect the "script".

If you're doing dev-ops with such scripts, you already need to handle the environment in general.

Re:Shell Style Guide by pas on Tuesday May 15, 2018 @10:51AM (#17074331)
> not sure what the above "and that's it" means. That it's not Haskell? Yes, it's not.

That scripting in Python is pretty bad. It makes thing harder and at the same time you still have to think a lot about what can go wrong, because there's no enforced error handling.

Re:Shell Style Guide by tormeh on Tuesday May 15, 2018 @01:56PM (#17076078)
Yeah, even Java doesn't force you to handle errors. Please, calm down. "Scripting" in a compiled language is not practical. People use the word "script" for a reason - it's because they don't want to deal with a language that forces them to think about everything that could go wrong. For some tasks that's perfectly sensible. For other tasks, there is Rust, Haskell and many others.
Re:Shell Style Guide by pas on Wednesday May 16, 2018 @05:46PM (#17086770)
Checked exceptions are nice. You can use them if you want to make them part of your API surface.

> "Scripting" in a compiled language is not practical.

The premise is that scripts grow, and you should switch to Python. Which might be okay for Google, but seems to be only a very small step up from Bash, if any at all. (I've outlined the reasons, why I think it's not worth it.)

I do a lot of scripting, in Bash, and when that stars to grow on me, it's time to think about the problem for real. And usually a blind rewrite in Python is not the way to go.

> For some tasks that's perfectly sensible.

Those are the one-off scripts, no? Anything that should run with some regularity, anything that should be reproducible, that handles valuable data, is not something that should be cobbled together in bash/python and thrown into /etc/cron.d . Or apparently that's how Google rolls.

Yeah, well, maybe not everyone is an SRE, so the use case here seems to be build scripts and other not-so-critical scripts, that still have to be maintained, where knowledge of Bash/POSIX-sh is not really assumed, it should just work for anyone who checks out the repo.

Re:Shell Style Guide by jamespo on Tuesday May 15, 2018 @11:54AM (#17074896)
Some actual examples would be nice; this just sounds like nirvana fallacy.
Re:Shell Style Guide by dkrikun on Tuesday May 15, 2018 @12:47PM (#17075332)
Dunno, why do "scripting", it's a rather clean oop language. For scripting use bash or perl maybe.
Re:Shell Style Guide by dkrikun on Tuesday May 15, 2018 @12:46PM (#17075319)
"That it's not Haskell" -- gold