From owner-freebsd-questions@FreeBSD.ORG Tue Apr 6 13:21:15 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A95FF106564A for ; Tue, 6 Apr 2010 13:21:15 +0000 (UTC) (envelope-from merlyn@stonehenge.com) Received: from red.stonehenge.com (red.stonehenge.com [208.79.95.2]) by mx1.freebsd.org (Postfix) with ESMTP id 8EC428FC12 for ; Tue, 6 Apr 2010 13:21:15 +0000 (UTC) Received: by red.stonehenge.com (Postfix, from userid 1001) id 02FF97400; Tue, 6 Apr 2010 06:21:14 -0700 (PDT) From: merlyn@stonehenge.com (Randal L. Schwartz) To: RW References: <4BB8108A.9080104@FreeBSD.org> <1270371713.5861.98.camel@tao.thought.org> <86aatjnsts.fsf@red.stonehenge.com> <861vevnsow.fsf@red.stonehenge.com> <20100404163353.GA15198@guilt.hydra> <20100404201442.b456044e.freebsd@edvax.de> <4BB9A5ED.3040309@infracaninophile.co.uk> <20100405173632.739a0c42@gumby.homeunix.com> <20100406015544.GA21119@guilt.hydra> <20100406132049.641b9edf@gumby.homeunix.com> x-mayan-date: Long count = 12.19.17.4.10; tzolkin = 2 Oc; haab = 3 Pop Date: Tue, 06 Apr 2010 06:21:14 -0700 In-Reply-To: <20100406132049.641b9edf@gumby.homeunix.com> (RW's message of "Tue, 6 Apr 2010 13:20:49 +0100") Message-ID: <86wrwkiunp.fsf@red.stonehenge.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-questions@freebsd.org Subject: Re: perl qstn... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2010 13:21:15 -0000 >>>>> "RW" == RW writes: RW> Imperative languages have a natural order of decision followed by RW> action, and code is most easily readable if the syntax doesn't try to RW> subvert that. And yet, there's an equally valid argument that the most important thing should stand out the most. In that sense, in the Perl statement: warn "x = $x, y = $y, z = $z\n" if $debug; ... the most important part is that it's printing something to stderr, and what's being printed. It's only minor that it's only when debugging, and luckily Perl lets us relegate that to the tail end of the statement. Now, if you argue "oh, the most important thing there is 'if debug'", then fine, you'd write that as: if ($debug) { warn ... } And I'd be fine with that. But I tend to see that layout as a lot of noise just to add a minor conditional. Or you could speak Perl with a Shell accent, and say $debug and warn ...; Fine, that also works, and some part of your audience will hate you, and another part will be totally cool with it. But this *is* the reason There's More Than One Way To Do It in Perl. You can write Perl that most naturally expresses what you believe is important in the code. If you don't like all this freedom, there's always Python. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion