Home

The Arg Vector Dispatch Pattern in Shell

2017-01-13

Three features:

Enforcing consistency between the "UI" and code layout. The "action" pattern, like cvs, svn, hg, git, etc.

parallel-each() { xargs -n 1 -P 10 | $0 "$@" }

parallel-demo() { seq 10 | parallel-each sleep }

PROBLEMS: Completion

Not sure what to call this.

"$@"

-- I got this from static python.

It has downsides -- lack of help.

OIl will fix this.

Important feature: find or xargs can use it. They start processes.

chroot can use it.

chroot $0 ls /

oil may fold in find and xargs.

Find my old hacker news post.

Link to taskfile;

Cool new trick: complete for function names!

Why not use Make?

QUOTING.

LInk to dotd.sh. THE OFFICIAL MANUAL SUGGESTS THIS.

Other languages have dataflow :e

I've often heard the advice to rewrite shell scripts in another of those languages once they've reached a certain size. While I understand the motivation behind that advice, it's also true that shell has uniquely expressive features.

I have one or two more posts in this category, and then I will sum up with conclusions with respect to oil's language design.

I like higher level languages.
My favorite language is Python, but there are languages that are at even higher levels of abstraction.

Matlab and R are vectorized; Lisp is point free.


Discuss this post on Reddit