Re: RFC 39 (v2) Perl should have a print operator
[email protected] ("David L. Nicol") Thu, 17 Aug 2000 19:34:06 -0500
| Newsgroups | perl.perl6.language.io |
|---|---|
| Organization | University of Missouri - Kansas City supercomputing infrastructure |
| Message-ID | <[email protected]> |
I like very much a print() that returns the value of what you printed rather than success. I am always needing to define littly intermediate temporaries so I can insert debugging code inside huge, tortuous expressions. I don't know if C(>"print me"<) is it though. Did you take a look at RFC 66 before writing version 2? It suggests that angle brackets with a file handle on one side or the other turn into IO operators. I don't recall specifying what the return value of the interaction would be, but the non-file thing would work pretty well. Assuming "nothing" to mean "the default file handle" with an angle bracket in a void context, we've got the print operator. Don't know how it binds, probably at the same level as operator C<<> to prevent riots. Which is all right. That's what parentheses are for. So I'm suggesting that 39 and 66 merge, and the print operator be either angle bracket with void on the other side of it from the thing that gets printed. $result = 32 + (< 23 + 12); will print "35" and load C<$result> with 67. So when we want to take the debugging print out, there's just one char to remove instead of both. > > The only comment this RFC has had so far is "Ick!" -- Jonathan Scott > Duff <[email protected]> I agree - inverse angle brackets won't > improve Perl's reputation as an ugly language. Maybe I will get used to > them (and if I won't no-one will). Or maybe not. Perhaps the print > operator should be: > > p(LIST) > > so that other delimiters could be used. Or we could hijack: > > ?LIST? -- David Nicol 816.235.1187 [email protected] Damian Conway for president