git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: demerphq <demerphq@gmail.com>
Cc: "Matt Kraai" <kraai@ftbfs.org>, git@vger.kernel.org
Subject: Re: [PATCH] gitweb: merge boolean feature subroutines
Date: Sun, 04 Jan 2009 13:25:50 -0800	[thread overview]
Message-ID: <7v8wpqu5k1.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 9b18b3110901040341n5ff5fa09s878228131d11d2a6@mail.gmail.com

demerphq <demerphq@gmail.com> writes:

> Is it really deep perl magic to do:
>
>   return $val eq 'true';
>
> instead of
>
>   return $val eq 'true' ? 1 : 0;

No, neither are magicky.  But your argument to favor the former over the
latter that goes down to XS level was all about deep magic, and you wrote
yourself:

> ... It is not a good idea to use 0 as a replacement for perls false, as
> the two have different behaviour.

My point is that any caller that cares about the differences of "Perl's
true false" and 0 when talking about a function that returns a yes/no
value is already soaked too deep in Perl's deep magic.  I would want the
code to be maintainable by people who does not care the deep voodoo, and
for that reason, I do not want the callers to care.

Having said that, I think it is perfectly fine to favor returning "$val eq
'true'" over returning "$val eq 'true ? 1 : 0".  But that is not because
it is truer way to say false from Perl experts' point of view, but because
it is shorter and more to the point.

      parent reply	other threads:[~2009-01-04 21:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-03 15:31 [PATCH] gitweb: merge boolean feature subroutines Matt Kraai
2009-01-03 15:31 ` [PATCH] gitweb: pass the key to the " Matt Kraai
2009-01-03 16:18 ` [PATCH] gitweb: merge boolean " demerphq
2009-01-03 16:40   ` Matt Kraai
2009-01-03 16:51     ` demerphq
2009-01-03 17:13       ` Matt Kraai
2009-01-03 17:41         ` demerphq
2009-01-04  5:30   ` Junio C Hamano
2009-01-04 11:41     ` demerphq
2009-01-04 15:58       ` Matt Kraai
2009-01-04 22:07         ` Jakub Narebski
2009-01-04 21:25       ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v8wpqu5k1.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=demerphq@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=kraai@ftbfs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).