Re: We know what you need, and we'll push it down your throat.

[prev] [thread] [next] [lurker] [Date index for 2006/12/22]

From: Abigail
Subject: Re: We know what you need, and we'll push it down your throat.
Date: 15:43 on 22 Dec 2006
--wr1Q/2bz0MCWWNYv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Dec 22, 2006 at 09:16:08AM -0600, Peter da Silva wrote:
> On Dec 22, 2006, at 8:10 AM, Abigail wrote:
> >In Perl6:
> >
> >    print sqrt(9) + 7;  # Prints 10.
> >    print sqrt (9) + 7; # Prints  4.
>=20
> Holy Mary's Abscessed Teeth.
>=20
> Is this because whitespace is significant in the parse tree, or because=
=20
> sqrt( is a token? Or don't I want to know?


Worse.

The space influences precedence.

Fully parenthesized,=20
    the former is read as:  ((sqrt(9)) + (7))
    the latter is read as:  (sqrt((9) + (7)))


Now, the other example I gave (%hash {code} vs %hash{code}) is a parsing
issue. Any parenthesized block preceeded by a space is a coderef that is
executed directly. More or less a short hand for 'sub {code} -> ()'.
But without the space, well, then it can be an index in a hash.

Now, you might wonder what was gained by having this monster. It enables
you to leave of the parenthesis in an if statement. Perl goes from a
formfree language to a language with syntactically whitespace for the
benefit of making parenthesis around a conditional optional.

Woopy.


Abigail
(So, what's 'grep {/foo/} @bar;' meaning in perl6?)

--wr1Q/2bz0MCWWNYv
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFFi/01BOh7Ggo6rasRAk9DAJoDYeACV0i7NR9/gc2el2w/ScP1sgCfY0SE
gAWoVvGsh4JqJQxRcukpZGg=
=wjkK
-----END PGP SIGNATURE-----

--wr1Q/2bz0MCWWNYv--
There's stuff above here

Generated at 03:02 on 01 Jan 2007 by mariachi 0.52