Late last year I implemented a few Perl 6 features in Perl 5.
A couple of things have emerged that may be relevant to the
Perl 6 design. Certainly they're things that I'm curious about.
I'll send the other one in a separate message to keep the
threads apart: this message is about 'say'.
The definition of 'say' is very simple:
say <foo>
is exactly equivalent to
print <foo>, "\n"
and that's just the way it works in Perl 5.9.3. In fact,
that's how it's compiled. A few people on p5p have expressed
some disquiet that
say "foo";
will print the string "foo$,\n$\". I'm inclined to agree that
this seems sensible only when $, and $\ are both empty, as
they are by default.
I'm not sure what the Perl 6 analogues are of $, and $\. I've
heard that $\ is a per-filehandle setting. Is there any analogue
of $,? Presumably there is.
In short, I'm curious as to why say is defined as it is, rather
than, for example, to be the equivalent of the Perl 5 code
{ local $\ = "\n"; print <foo> }
I've searched the archives of this list, but failed to turn
up anything relevant.
Cheers,
Robin