RFC: replace $ with % in the Miller put/filter DSL #112

Open
johnkerl opened this Issue Oct 12, 2016 · 1 comment

Projects

None yet

1 participant

@johnkerl
Owner
johnkerl commented Oct 12, 2016 edited

This would be a backward-incompatible change, so, it would be Miller 5.0.0.

I initially chose $ for field names in analogy with awk: in awk you do $1, $2, $3; in Miller you do $Country, $City, $Region. That is well and good.

However, $ is also used by the shell and one way to build up Miller-DSL statements is to interpolate shell variables. E.g. now you have to do something like

for j in 1 2 3 4; do
  mlr --from myfile.dat put '$output = '$j' * $i' # Note shell variable outside single quotes
done

With the proposed change, you could do

for i in 1 2 3 4; do
  mlr --from myfile.dat put "%output = $j * %i" # Shell-vars with $ and field names with %
done

The expense, of course, is the need to update any scripts you already have which use the Miller DSL. (This only affects mlr put and mlr filter; non-DSL verbs like stats1 and sort are, of course, completely unaffected.)

In the absence of any feedback I'd prefer to make this change. (Scheduling of 5.0.0 is probably November/December 2016.) However, I'd definitely prefer some feedback. :)

@johnkerl johnkerl changed the title from RFC: replace $ with % to RFC: replace $ with % in the Miller put/filter DSL Oct 12, 2016
@johnkerl
Owner

Initially requested by @cym13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment