News for hackers. Stuff that matters.
Re:Aho – a Git implementation in Awk by forrestthewoods on Saturday February 10, 2024 @02:05PM (#39329208)
Neat project. It’s always fun to see tools pushed beyond their normal use cases.

That said, it should be a criminal offense to write any tool this large and complex in any language that can’t be used in a powerful step debugger.

TBH I’m increasingly frustrated by the amount of code written in Bash. I kind of hate Python for various reasons. But if 100% of Bash was replaced with Python I think the world would be a better place.

Re:Aho – a Git implementation in Awk by riddley on Saturday February 10, 2024 @02:30PM (#39329435)
I'm mostly in concordance, but one thing I think every scripting language got wrong is how painful it is to run external binaries. Sure it can be done but it could be as easy as a shell script.
Re:Aho – a Git implementation in Awk by forrestthewoods on Saturday February 10, 2024 @02:49PM (#39329574)
Agreed.

That said, stdout/stderr is such a bloody, inconsistent nightmare. I’m not totally convinced that “chain small binary programs together” is better than “one language with useful libraries”.

Bash is admittedly nice for small things. But it always spirals out of control. And rarely gets ported.

Also my life is primarily Windows and if you want everything to “just work” across mac/linux/win it’s easier to just use Python or sometimes even Rust. I often wish I could easily write and run single-file rust scripts.

Re:Aho – a Git implementation in Awk by wazbug on Saturday February 10, 2024 @05:35PM (#39330852)
Ruby is nice in this regard though :-)

    x = `git --version`
    puts(x) #=> "git version 2.43.0"
Re:Aho – a Git implementation in Awk by KerrAvon on Sunday February 11, 2024 @12:48AM (#39332919)
Ruby is really nice in this regard, in fact — you’re not limited to backticks; you can use any quote delimiters you want.
Re:Aho – a Git implementation in Awk by riddley on Sunday February 11, 2024 @07:54AM (#39334668)
Ruby is nice in every regard :) Most languages have some form of backticks to run an external binary. When I left my original comment I got a phone call in the middle of it and rushed it, sorry about that. What I really meant was having the versatility of the big 3 file descriptors along with return codes, etc. You can use Open3 (in the ruby case) but it's unwieldy compared to, say bash.
Re:Aho – a Git implementation in Awk by Brian_K_White on Sunday February 11, 2024 @03:32AM (#39333446)
Only if python gained the ability to execute externals and handle stdin/stdout/stderr, return value, & environment directly instead of through exec(). And ditched the meaningful indentation. And was backwards compatible so that old scripts work today and today scripts work tomorrow.

Bash has it's own uglies so I guess it's fair enough to compare two imperfect things, but the problem is these are two different jobs, and python just doesn't do the job bash does, and that job needs doing, so python can't be the replacement.