Re: RFC 39 Perl should have a print operator

2000-09-05 Thread Eryq

Jon Ericson wrote:

 I had considered this, but I don't want Yet Another Quote-like Operator
 (YAQO).  Perhaps I should just change this RFC to call for a built-in
 tee operator:
 
   push @lines, tee($_) for ;
 

I would vote strongly against a built-in "tee" operator.
You can achieve the same effect by tying a filehandle to an
object which tees output.  Consider this hypothetical Perl5
snippet:

use IO::Tee;

my $OUT = IO::Tee-new(\*STDERR, "|logger", "my.log");

print $OUT "Hello, nurse!\n";

And if you hate OO syntax, it could export a "tee" function
which would do the construction but be less ugly to look at:

my $OUT = tee(\*STDERR, "|logger", "my.log");

I would really like to avoid adding more special operators
when their functionality is not really primitive.  
 
-- 
  ___  _ _ _   _  ___ _   
 / _ \| '_| | | |/ _ ' /   Eryq (Erik Dorfman)
|  __/| | | |_| | |_| | President, ZeeGee Software Inc.
 \___||_|  \__, |\__, |___/\ http://www.zeegee.com
   |___/|__/  [EMAIL PROTECTED]



Re: RFC 39 Perl should have a print operator

2000-09-02 Thread Ken Rich

Perl supplies an operator for line input - angle brackets.  This is no
analogous operator for output.  I propose "inverse angle brackets":

How about quotes?  A quoted lhs expression could mean print.  A quoted lhs
expression preceded by a file handle could mean print to filehandle.

Tom Christiansen's complaint seems irrelevant to me because a print
statement is already ugly in that visually interminable way.

"expr";

could be the special case of the more general

print//;
print[];
print();

parallel to the m//; and other such constructions.
Hm, maybe then I'd suggest shortening 'print' to 'o' for output:

o//;
...etc...


As a corollary maybe I'd suggest similarily regularizing input:

i//;
i[];
i();

with the traditional special case of:

;

I know, parallel construction for not really parallel item.

"i" and "o"!

Hm, I guess this may run afoul of the qq() and q() syntax, or at least
gets kind of mushed up with them.  Well, what the heck, if they are
on the lhs...?

The only losers would folks who have used quotation marks of various
kinds as multi-line comment delims.  (...me)  The other only losers
would be those who have stuck evaluatable exprs inside lhs quoted
stuff to be exec'd for their side effects, yuck.  

The save keystrokes at any cost people should love it (though I am
always puzzled why they don't use editor macros then).
The hate context people will hate it.  Why such a short timeline on these
discussion groups?  It's summer, yall.

--
-ken rich   "Strong typing is for people
 with weak memories."
 --Compucius[EMAIL PROTECTED]