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 away.  What's wrong with putting a
 command name at the start of a command, anyway?  Note that the
 readline operator is not normally subject to this same problem
 as its operand is a handle, not a long string.

I would consider this to be bad style:

  qq{
  ...
  }; # yuck!

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 http://www.perlmonks.org/index.pl?node_id=9108)

The main point of this statement is the Schwartzian Transform, but it
also prints the original lines en passant.  

 Also, it makes it icky to quote Perl code in mail messages;
 see above. :-(

Agreed.  Good style would avoid this problem.  The example in the
synopsis of this RFC should be:

  my $output = "Print this line.\n";

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King



Re: RFC 51 (v2) Angle brackets should accept filenames a

2000-08-09 Thread Jon Ericson

Chaim Frenkel wrote:
 What does
 
 $foo = "filename";# 1
 $bar = "another";
 $gaz = "filename; # 2
   ^ add " here

 Does #2 get the second line or the first?

$gaz contains the second line.  Otherwise this:

  while ('filename'){print;};

won't work.  This gets a little hairy, I admit.  

 Can the  contain a function? 

Of course.  Stick any old list there.

 Your example seems to indicate that
 it can. But if it is hard for me to parse visually, I'm not sure
 how easy it would be for the parser.

This is an implemenation detail.  On the other hand, I was hoping that
it would be easy for a human parser.  Perhaps it only takes some getting
used to.  Like the first time I saw something like:

  for ($foo){
/pattern/  next;
print join ' ', /pattern_with_groups/;
  };

To my eye angle brackets signify input.  

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King



Re: RFC: println()

2000-08-07 Thread Jon Ericson

[Reply-To set to [EMAIL PROTECTED]]

Ed Mills wrote:
 
 I actually saw this in the newsgroups and thought it was a neat idea. What
 about
 
println $textvar;
 
 instead of
 
print "$textvar\n";
 
 Ever so much easier to read and write, prints the arg and appends \n.

You can currently get this behaviour with print if you set $\ = "\n".  I
expect perl 6 to look more like perl 5 than Pascal.

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King