Remix.run Logo
xorcist 7 days ago

"Essentially the same thing" as a shell pipe, except each function run sequentially in full, keeping output in a variable. So nothing like a shell pipe.

For short constructions '$out = sort(fn($in)' is really easier to read. For longer you can break them up in multiple lines.

  $_ = fn_a($in)
  $_ = fb_b($_)
  $out = fn_c($_)
Is it really "cognitive overhead" to have the temporary variable explicit? Being explicit can be a virtue. Readability matters in a programming language. If nothing else I think Python taught us that.

I am skeptical to these types of sugar. Often what you really want is an iterator. The ability to hide that need carries clear risk.

scotty79 6 days ago | parent [-]

I though so too, but if you are using same name for various things then the whole thing can't be typechecked. Not in PHP at least. In Rust this would work perfectly with typechecking.