--wzJLGUyc3ArbnUjN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 06, 2011 at 11:57:09PM +0900, David Masover wrote:
>=20
> while(<STDIN>) {
>     chomp;
>     print "$1\n" if /^Hello, (.*)/;
> }
>=20
> ...and that's a short, mostly-readable example because I frankly don't=20
> remember enough about Perl to make it really dangerous. Even so, look at =
how=20
> twisted it is already. If you're not a Perlist already, it's not obvious =
that=20
> "while(<STDIN>)" actually loops over each line of standard input. Once yo=
u get=20
> that, you might figure out that chomp and the regex should apply to these=
=20
> lines, but it's much more common to find a somewhat larger loop body, wit=
h=20
> actual variables mixed and matched with automagic ones.

Actually, within the context of Perl, I see no problem with that code.
There are little bits of elegance that one can eke out of code via the
implicit scalar in Perl that justify the way $_ works -- which is
actually not the same thing as the proposed "item" at all.  Where $_ in
Perl is an implicit scalar variable, "item" in Ruby as proposed would be
a default explicit argument.  Given its requirement for explicit calling,
I really don't think it buys us nearly enough to justify the negative
consequences of it, and I don't think the idea of a Perl-style implicit
scalar variable is consistent with the "flavor" of Ruby code in general,
so I think we agree in effect even if I don't find your specific example
at all compelling.

Basically any programming language keyword and bit of syntactic sugar can
become a problem if misused (including the implicit scalar in Perl).  It
is up to the programmer's sense of how to write clear code to keep
syntactic sugar from becoming a deteriment to code clarity rather than a
help.  It is up to the language's definers and implementors to ensure
that syntactic sugar that mostly consists of detriments doesn't make it
into the language.  I don't think $_ in Perl mostly consists of
detriments for that language; I do think the proposed default argument in
Ruby mostly consists of detriments.

--=20
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

--wzJLGUyc3ArbnUjN
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAk3tA3QACgkQ9mn/Pj01uKXzAQCeIGisZLkKeMLvoKMXEZ/y/k8q
BuYAmwUQ3bRp4S1d8xy8/5v3tnJ/uEHR
=3Fc5
-----END PGP SIGNATURE-----

--wzJLGUyc3ArbnUjN--

On Mon, Jun 06, 2011 at 11:57:09PM +0900, David Masover wrote:
>=20
> while(<STDIN>) {
>     chomp;
>     print "$1\n" if /^Hello, (.*)/;
> }
>=20
> ...and that's a short, mostly-readable example because I frankly don't=20
> remember enough about Perl to make it really dangerous. Even so, look at =
how=20
> twisted it is already. If you're not a Perlist already, it's not obvious =
that=20
> "while(<STDIN>)" actually loops over each line of standard input. Once yo=
u get=20
> that, you might figure out that chomp and the regex should apply to these=
=20
> lines, but it's much more common to find a somewhat larger loop body, wit=
h=20
> actual variables mixed and matched with automagic ones.

Actually, within the context of Perl, I see no problem with that code.
There are little bits of elegance that one can eke out of code via the
implicit scalar in Perl that justify the way $_ works -- which is
actually not the same thing as the proposed "item" at all.  Where $_ in
Perl is an implicit scalar variable, "item" in Ruby as proposed would be
a default explicit argument.  Given its requirement for explicit calling,
I really don't think it buys us nearly enough to justify the negative
consequences of it, and I don't think the idea of a Perl-style implicit
scalar variable is consistent with the "flavor" of Ruby code in general,
so I think we agree in effect even if I don't find your specific example
at all compelling.

Basically any programming language keyword and bit of syntactic sugar can
become a problem if misused (including the implicit scalar in Perl).  It
is up to the programmer's sense of how to write clear code to keep
syntactic sugar from becoming a deteriment to code clarity rather than a
help.  It is up to the language's definers and implementors to ensure
that syntactic sugar that mostly consists of detriments doesn't make it
into the language.  I don't think $_ in Perl mostly consists of
detriments for that language; I do think the proposed default argument in
Ruby mostly consists of detriments.

--=20
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAk3tA3QACgkQ9mn/Pj01uKXzAQCeIGisZLkKeMLvoKMXEZ/y/k8q
BuYAmwUQ3bRp4S1d8xy8/5v3tnJ/uEHR
=3Fc5
-----END PGP SIGNATURE-----