[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: es %dup



> I thought you were suggesting that ``exec <foo'' should
> mean  ``push foo onto input''

as an aside: this functionality is avaible with the predefined function ".",
as in rc and sh.

> You should have direct access to
> open, close, read, write, etc.

unclear.  read & write are still controversial, in my mind.  open, close,
etc. are provided, but insufficient, because you need to pick some fd
to work on.  as Donn notes, it's probably reasonable to add something
which returns an unused fd number that you can then use in open and
create calls.  how about
	<>{%newfd}
?

also, this points to a limitation in the syntax, which is that when
using the syntactic sugar, you can only use hard-coded, literal numbers
and not es-expressions.  for the next release, i'll add (on an experimental
basis only, %newfd, but to really use it, you'll need to bypass the
syntactic sugar and do direct %open, etc.  thus

	;; fd = <>{%newfd}
	;; exec {%create $fd foo}
	;; %dup 1 $fd {echo bar}
	;; exec {%close $fd}
	;; cat foo
	bar
	;;