9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] rc niggle, and proposed fix
@ 2011-06-20 19:48 erik quanstrom
  2011-06-22 16:02 ` Charles Forsyth
  0 siblings, 1 reply; 3+ messages in thread
From: erik quanstrom @ 2011-06-20 19:48 UTC (permalink / raw)
  To: 9fans

ifs seems a holdover.  it's only ever used in `{} yet
it's a global inherited variable.  so it's easy to write
a script that assumes that ifs is set to the default.

a seemingly useful way to use ifs is as a local.  one
would think
	ifs=burble fu=`{bar}
would be sensible, but unfortunately this is doubly
wrong.  the assignments aren't local since there is
no command, just assignments.  this could be fixed by
	ifs=burble {fu=`{bar}}
but if bar is a script and isn't quite careful about
setting ifs before using it, bar will produce surprises.

it seems to me the easiest way to fix this is to introduce
a new form of `{} that allows the splitting characters
to be specified without fidding ifs, so
	fu=`burble {bar}
(fortunately rc didn't adopt byron's `word form.)
this has the advantage of not breaking anything while
still allowing one to write scripts more precisely.

the code is contrib quanstro/rchistory.  enjoy.

- erik



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-22 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-20 19:48 [9fans] rc niggle, and proposed fix erik quanstrom
2011-06-22 16:02 ` Charles Forsyth
2011-06-22 16:21   ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).