Trey Harris raised the spectre of:

shades of C++, how about just

  $*STDERR <~ $foo;
Yes. Assuming C<infix:<~(IO,Object)> were suitably overloaded.

or

  $foo ~> $*STDERR;
Yes. Assuming C<infix:<~(Object,IO)> were suitably overloaded.

Not sure whether that would come "standard", but if not, here's
a first cut of the necessary module for future reference:

	module IO::Stroustrupian;

	# Output operators...
	my infix::<~(IO $fh, $datum) is multi is exported { print $fh: $datum }
	my infix::<~(IO $fh, @data)  is multi is exported { print $fh: @data  }
	my infix::~>($datum, IO $fh) is multi is exported { print $fh: $datum }
	my infix::~>(@data,  IO $fh) is multi is exported { print $fh: @data  }
	
	# Input operators...
	my infix::<~($var is rw, IO $fh) is multi is exported { $var = <$fh> }
	my infix::<~(@var is rw, IO $fh) is multi is exported { @var = <$fh> }
	my infix::~>(IO $fh, $var is rw) is multi is exported { $var = <$fh> }
	my infix::~>(IO $fh, @var is rw) is multi is exported { @var = <$fh> }


Damian


Reply via email to