Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Apr 2010 19:55:44 -0600
From:      Chad Perrin <perrin@apotheon.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: perl qstn...
Message-ID:  <20100406015544.GA21119@guilt.hydra>
In-Reply-To: <20100405173632.739a0c42@gumby.homeunix.com>
References:  <4BB8108A.9080104@FreeBSD.org> <1270371713.5861.98.camel@tao.thought.org> <86aatjnsts.fsf@red.stonehenge.com> <861vevnsow.fsf@red.stonehenge.com> <j2ya14066a01004040945z39191770k2f025752317fb14a@mail.gmail.com> <20100404163353.GA15198@guilt.hydra> <20100404201442.b456044e.freebsd@edvax.de> <o2oa14066a01004041148zd4ef8167q32b04d58daec8f9f@mail.gmail.com> <4BB9A5ED.3040309@infracaninophile.co.uk> <20100405173632.739a0c42@gumby.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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

On Mon, Apr 05, 2010 at 05:36:32PM +0100, RW wrote:
>=20
> IMO this is a bad mistake that other languages were quite right not to
> copy - a test shouldn't come after a block of code unless it's evaluated
> after the block (as in repeat...until)=20

There are more things in heav'n and earth, Horatio, than are dreamt of by
designers of eagerly evaluated prefix notation languages.

Actually, I'd think that using "unless" that way would be right up the
alley of the users of most programming languages, since "unless" is here
just being used the same way as an infix notation operator with very high
precedence.  If you want to get rigorous about it, I'd prefer this
approach:

    unless (condition) (result)

=2E . . where it uses strict prefix notation.  I know that some people
think postfix notation is the bee's knees because of implementation
reasons, but frankly, implementation should be something we never have to
see, in my opinion -- unless we're actually implementing it.  Computers
are for scut work; humans are for idea work.

Failing strict prefix notation, I'm okay with the way Perl and Ruby use
"unless".  This:

    (result) unless (condition)

=2E . . could be explained away as fitting with any of:

    1. conforming to natural language expectations, thus leaving
    implementation scut-work to the realm of the computer

    2. infix notation with very high precedence for "unless"

    3. lazy evaluation, where the (result) is not evaluated until it is
    needed, which gives the interpreter plenty of time to notice there's
    an "unless" immediately following it

Obviously, the "real" answer in the case of Ruby and Perl falls somewhere
around 1.5, but 3 is still a believable-sounding excuse, and perfectly
acceptable to me.

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

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

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

iEYEARECAAYFAku6lKAACgkQ9mn/Pj01uKWwwgCcDGIgnxJN3Barid73ViqvY1xQ
CSAAoO6L6lbh9+D7sI7HUqCVWKFLz0up
=qz4D
-----END PGP SIGNATURE-----

--IJpNTDwzlM2Ie8A6--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100406015544.GA21119>