Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Jon Ericson
Tom Christiansen wrote: > Perl already *has* a print operator: "print". :-) I think what I really want is a tee operator. > The problem with what you have there is that it hides the act of > output within an arbitrarily long circumfix operator whose terminating > portion is potentially very far

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Jon Ericson
Bart Lateur wrote: > For input, the handle is marked as a source: > > $data = ; > > In order to be symmetrical, your ousput handle should look and act like > a sink: > > >STDOUT< = $data; > > There. Now it's symmetrical. = $data; is symmetrical. I am considering thi

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Nathan Wiger
Jon Ericson wrote: > > Agreed. Good style would avoid this problem. The example in the > synopsis of this RFC should be: > > my $output = >"Print this line.\n"<; Would this be solved if print returned the string it printed? This seems to be what everyone's getting at: my $output = print

Re: RFC 39 Perl should have a print operator

2000-09-05 Thread Jon Ericson
Ken Rich wrote: > How about quotes? A quoted lhs expression could mean print. A quoted lhs > expression preceded by a file handle could mean print to filehandle. Have you seen ? > Tom Christiansen's complaint seems irrelevant to me because a print > statement i

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Bart Lateur
On Tue, 05 Sep 2000 16:46:03 -0700, Nathan Wiger wrote: >Would this be solved if print returned the string it printed? This seems >to be what everyone's getting at: > > my $output = print $r->name . " is $age years old\n"; I think that's the idea... and print may return undef if it fails to pr

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Jon Ericson
Bart Lateur wrote: > Also, > > print @items; > > should then return join($,, @items).$\ I would want it to return @items: @sorted = sort print @items; I'd prefer a different name (tee?) and keep print as it is. Jon -- Knowledge is that which remains when what is learned is forgott

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Peter Scott
At 04:40 PM 9/5/00 -0700, Jon Ericson wrote: >Bart Lateur wrote: > > For input, the handle is marked as a source: > > > > $data = ; > > > > In order to be symmetrical, your ousput handle should look and act like > > a sink: > > > > >STDOUT< = $data; > > > > There. Now it's symmetri

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Tom Christiansen
>Jon Ericson wrote: >> >> Agreed. Good style would avoid this problem. The example in the >> synopsis of this RFC should be: >> >> my $output = >"Print this line.\n"<; >Would this be solved if print returned the string it printed? This seems >to be what everyone's getting at: > my $outpu

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Tom Christiansen
>This is what I'd consider good style: > my @output = > map { $_->[0] } > sort { $a->[1] cmp $b->[1] } > map { [>$_<, expensive_func($_)] } # print original lines > <>; >(Modified from ) >The main point of this statement is the Sc

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Tom Christiansen
>I think that's the idea... and print may return undef if it fails to >print, and the printed string otherwise (always defined, even if it's an >emtpy string). Those are not the semantics of print. It returns true (1) if successful, and false (undef) otherwise. You cannot change that. If I wr

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Nathan Wiger
Jon Ericson wrote: > > I would want it to return @items: > > @sorted = sort print @items; > > I'd prefer a different name (tee?) and keep print as it is. Pretty much all the stuff being discussed right now can be stuck in a module: package Print::Variations; use Exporter; @EXPORT

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Jon Ericson
Tom Christiansen wrote: > Again, I can't *ever* remember wanting a function that did this. Rare things > shouldn't have hard-to-figure-out names. Why do you want it? Debugging or > something? Have you tried tie? I've found myself wanting this operator several times since I wrote the RFC - mos

Re: RFC 39 (v3) Perl should have a print operator

2000-09-05 Thread Tom Christiansen
>I've found myself wanting this operator several times since I wrote the >RFC - mostly for debugging and indicating progress. Nobody else seems >to be as fond of the syntax as I am, so I will withdraw the RFC. (Its >only virtue is the syntax.) I suggest you create a clever tie module that does

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