News for hackers. Stuff that matters.

garethrowlands

well duh
Re:Flint: A Visualization Language for the AI Era on Saturday August 01, 2026 @11:58AM (#49135514)
It's really not that simple. Yaml can be more token efficient but not necessarily. And it's often not the biggest factor.
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @09:33AM (#49058071)
I totally agree with you.

> the goodness of language for long code is inversely proportional to how nice it is for shell one-liners

Well, except for this bit. Oil or fish and awk are perfectly fine for one liners but don't repeat the mistakes of posix shell syntax.

Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @09:30AM (#49058034)
Yeah, I don't see pwsh finding a place in the ecosystem. Even oil or fish struggle. Their place was mostly taken by python (which is a huge dependency but not another huge dependency).
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @09:26AM (#49057992)
I like your 2026 perspective. Objectively, the posix shell syntax is genuinely bad, even though the overall system that it enabled is amazing. It's a very old system that took off because it solved a problem - history is kind to it because of that context. Though, awk is around the same age and provides a proof-by-existence that posix shell syntax didn't have to be make these mistakes.
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @09:21AM (#49057962)
The trinary is semantically just an if expression though. Perl inherits C's problem that `if` can't be used in an expression context:

  my $x = if ($cond) { 1 } else { 2 };  # Syntax error
Because of this, Perl introduces a second syntax to plug the gap:

  my $x = $cond ? 1 : 2;
That expression is neither obtuse nor hard to read.

Something like the code below is hard to read:

  my $fee =
    $is_member
        ? ($is_student ? $student_member_fee : $member_fee)
        : ($is_student ? $student_fee        : $standard_fee);
It's equivalent to the following code that uses `if`:

  my $fee;
  if ($is_member) {
      if ($is_student) {
          $fee = $student_member_fee;
      }
      else {
          $fee = $member_fee;
      }
  }
  else {
      if ($is_student) {
          $fee = $student_fee;
      }
      else {
          $fee = $standard_fee;
      }
  }
But ideally you would want to write this:

  my $fee =
    if ($is_member) {
        if ($is_student) {
            $student_member_fee
        }
        else {
            $member_fee
        }
    }
    else {
        if ($is_student) {
            $student_fee
        }
        else {
            $standard_fee
        }
    };
Though, of course, perl5 doesn't allow that.
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @08:59AM (#49057742)
Absolutely!

Your company likely started using bash before python was ubiquitous.

Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @08:55AM (#49057708)
I still think that learning the shell environment makes a lot of sense these days. But mainly for interactive use. It's amazing the scripts your LLM can make you with, say, fd and fzf.
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @08:52AM (#49057683)
Heh, I like that. We are indeed stuck with posix shell syntax; I didn't claim we weren't.
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @08:51AM (#49057667)
There are plenty of alternative shells that don't suffer these problems. Posix syntax didn't win because it was better - it's the classic 'worse is better'.

> Old doesn't imply arcane.

Indeed so. For example, awk is about the same age but doesn't suffer the same problems.

> the shell syntax was never meant to be anything like a systems or application programming language

A programmable shell is not only like a programming language, it is a programming language. Systems tasks have some specialised requirements but, overall, scripting is programming. There is nothing in the problem domain that requires the posix string-substitution problems.

If fish or oil had existed back then, they would likely have won, since they are better.

Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @08:39AM (#49057539)
Sorry, the backticks were merely meant to delimit the code.
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @07:57AM (#49057214)
Some models are better than others. But it's all fixable with a relatively small skill. Try PowerShell Windows Skill perhaps.
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @07:50AM (#49057160)
$ Hey, claude, I've figured out the powershell one-liner we need and I've pasted it below. Please insert it into the application.

...

I have analysed your idiomatic one-liner and propose adding the following 30 lines into the application Yes/Yes and always accept such idiocy/No

ESCAPE ESCAPE

/clear

I want to update my powershell skill so that it writes idiomatic pipelines and does not introduce idioms from other languages.

[PASTES overeagerness wording from Claude prompting best practices]

Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @07:39AM (#49057085)
I have some absolutely amazing bash scripts that I would never have contemplated making myself in bash. And they'd only have been somewhat better in python. Claude for the win!
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @07:27AM (#49056996)
> System shell, however, isn't meant for writing entire applications.

Programmable shells are, in fact, for programming. That posix shell syntax makes it impractical for meaningfully large scripts is something you just accept. And, realistically, it is something you have to accept.

Minimalism isn't why posix shell syntax is bad. For example, awk and jq are minimal but don't make the same mistakes.

Powershell was never designed to be your system shell (Windows doesn't really rely on one) but the main reason it can't be the shell is startup time, which rules it out of wrapper scripts. Its having lots of features might contribute to that but it's not the problem per se (being built on .net is the reason - that and startup time not really mattering on windows). Its lacking the syntax problems of posix shells is very much not a problem. Powershell's error handling is just fine, by the way.

The startup time of even pwsh is too slow to be usable in many scenarios.

PowerShell's not going to be the system shell on your *nix box but it wasn't designed to be. But your posix shell isn't the system shell because it's better. It's pretty much the ultimate expression of worse is better.

That's why there's an industry of alternatives without the faults, such as oil, elvish, fish, nushell. And why awk is so popular.

Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @06:57AM (#49056777)
The only upside of weird bash tricks is there's so much bash out there that the LLMs are really well trained on it - so you won't have to read the script, just the tests.
Re:A shell colon does nothing. Use it anyway. on Sunday July 26, 2026 @06:54AM (#49056764)
Articles like this are fun but they all come from posix shell syntax being fundamentally bad for scripting/programming. All the piping stuff is great, of course. And the overall ecosystem is great. But the interpretation of the script itself working by a series of string substitutions is a mechanism we wouldn't accept in a regular programming language. And there's no excuse for it really, except that shell syntax is really, really old.

For example, what does `$foo` mean in shell syntax? In any reasonable language (perl or powershell, for example, or python if you drop the `$`), it's an expression that evaluates to whatever value's inside that variable. In shell, `$foo` isn't an expression in that sense, and what it does depends on what's inside it via a variety of string substitution rules.

This is the main reason we have arcane articles like this.

That said, nice article.

Re:Scarf has moved away from Haskell on Saturday July 11, 2026 @11:30AM (#48872888)
The number one hard working concept in Haskell is parameterisation. A typical Haskell concept is just a concept, not a Haskell concept.
Re:Can you see three trees? on Saturday June 20, 2026 @04:04PM (#48612496)
That map doesn't seem to include the trees in actual parks. Somewhere like Hampstead Heath or Richmond Park has actual woods.
Re:Can you see three trees? on Saturday June 20, 2026 @04:02PM (#48612476)
That's awesome. Though, it doesn't seem to think Hampstead Heath has any trees. Nor Croydon, not even Thornton Heath. The Wilderness in Richmond Park seems to be a missing spot, as are some of the plantations (maybe Isabella Plantation, my map fu is failing me). Maybe the royal parks keep their own records?
Re:Why Reliability Demands Functional Programming on Sunday December 28, 2025 @12:36PM (#46412768)
Citation needed.
Re:Ditch your (mut)ex, you deserve better on Tuesday November 18, 2025 @11:07AM (#45968083)
STM isn't really used in Go like it is in Haskell.

Here's the example from a Go STM package that's based on Haskell STM. It has gotchas that you won't encounter in Haskell though, due to the nature of these languages.

https://github.com/anacrolix/stm/blob/master/cmd/santa-examp...

For the equivalent Haskell, check out the link at the top of the file.

Re:The Pragmatic Programmer: 20th Anniversary Edition on Monday November 17, 2025 @05:36AM (#45952407)
It's very good. And quite short!
Re:Removing XSLT for a more secure browser on Wednesday November 05, 2025 @12:27PM (#45825457)
XSLT's matching rules allow a 'push' style of transform that's really neat. But you can actually do that with any programming language such as Javascript.
Re:Removing XSLT for a more secure browser on Wednesday November 05, 2025 @12:23PM (#45825403)
I used to use XSLT a lot, though it was a while ago.

You can use Javascript to get the same effect and, indeed, write your transforms in much the same style as XSLT. Javascript has xpath (still). You have a choice of template language but JSX is common and convenient. A function for applying XSLT-style matching rules for an XSLT push style of transform is only a few lines of code.

Do you have a particular example where you think Javascript might be more verbose than XSLT?

Re:John Carmack on Mutable Variables on Friday October 31, 2025 @10:01AM (#45772077)
The term 'variable' is from mathematics. As others have said, the values of variables do vary but they do not mutate.
Re:Simplify Your Code: Functional Core, Imperative Shell on Tuesday October 28, 2025 @05:28AM (#45730771)
One way to get some intuition with FCIS is to write some Haskell.

Because Haskell programs pretty much have to be FCIS or they won't compile.

How it plays out is...

1. A Haskell program executes side effects (known as `IO` in Haskell). The type of the `main` program is `IO ()`, meaning it does some IO and doesn't return a value - a program is not a function

2. A Haskell program (code with type `IO`) can call functions. But since functions are pure in Haskell, they can't call code in `IO`.

3. This doesn't actually restrict what you can do but it does influence how you write your code. There are a variety of patterns that weren't well understood until the 1990s or later that enable it. For example, a pure Haskell function can calculate an effectful program to execute. Or it can map a pure function in a side-effecting context. Or it can pipe pure values to a side-effecting stream.

Re:Simplify Your Code: Functional Core, Imperative Shell on Tuesday October 28, 2025 @05:12AM (#45730665)
Surely transactions are a pretty good example of where functional core / imperative shell is a good guide. You really don't want to be doing arbitrary side effects inside your transaction because those can't be backed out. Check out STM in Haskell for a good example.
Re:Simplify Your Code: Functional Core, Imperative Shell on Monday October 27, 2025 @07:34PM (#45727612)
I'm unclear what you're suggesting here. Are you suggesting you couldn't write a POS in Haskell, say?
Re:Simplify Your Code: Functional Core, Imperative Shell on Monday October 27, 2025 @07:33PM (#45727598)
> Indeed, the general idea of imperative assembly comes to mind as the ultimate "core" for most software.

That's not what functional core, imperative shell means though. It's a given that CPUs aren't functional. The advice is for people programming in languages that have expressions - ruby, in the case of the original talk. The functional paradigm mostly assumes automatic memory management.

Older »