2009/6/8 Hugo Mills <h...@carfax.org.uk>:
> On Mon, Jun 08, 2009 at 03:50:47PM +0000, Isaac Close wrote:
>> --- On Mon, 8/6/09, Hugo Mills <h...@carfax.org.uk> wrote:
>> > > On Mon, Jun 08, 2009 at 02:53:12PM +0100, Daniel Pope wrote:
>> > >
>> > > result = 1 if test() else -1
>> > >
>> > > the idea being that the difference in syntax stresses
>> > the success path
>> > > as the default with the failure path as a fallback.
>> >
>> >    Eww. That's *intensely* ugly.
>>
>> I disagree. The above makes sense to me and fits on one line, whats
>> so *intensely* ugly about it ?
>
>   It messes with the expected syntax of the "if" and "else" keywords,
> in addition to being a ternary operator (and hence being inherently
> obfuscatory and hard to read).
>
>   Hugo.
>
> PS. I see my .sig quote generator is having an appropriate moment...

The perl best practices book has something like
                   #name format              #salutation
$salutation = $name eq ''                ? 'Dear customer'
                 :  $name =~ /regex../    ? "Dear $1"
                 :  $name =~ /regex/      ? "Dear Dr $1"
                 ;

Whether you consider that readable is another question - it actually
looks reasonably even with complex sections, tests, regexes with
matching substring return - all so long as it is indented into a clear
table...

Anton

-- 
Anton Piatek
email: an...@piatek.co.uk       
blog/photos:                    http://www.strangeparty.com
pgp: [0xB307BAEF]       (http://www.strangeparty.com/anton.asc)
fingerprint: 116A 5F01 1E5F 1ADE 78C6 EDB3 B9B6 E622 B307 BAEF

No trees were destroyed in the sending of this message, however, a
significant number of electrons were terribly inconvenienced.

-- 
Please post to: Hampshire@mailman.lug.org.uk
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------

Reply via email to