public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: vapier@gentoo.org, tools-portage@gentoo.org,
	Kent Fredric <kentnl@gentoo.org>
Subject: Re: [gentoo-dev] [PATCH] app-portage/eclass-manpages: Add support for @DEFAULT-ASSUMED
Date: Mon, 01 May 2017 18:02:56 +0200	[thread overview]
Message-ID: <1493654576.29015.1.camel@gentoo.org> (raw)
In-Reply-To: <20170430213801.21789-1-kentnl@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 2433 bytes --]

On pon, 2017-05-01 at 09:38 +1200, kentnl@gentoo.org wrote:
> From: Kent Fredric <kentnl@gentoo.org>
> 
> @DEFAULT-ASSUMED allows eclasses to document any implied value
> that internal code will assume when the ENV var is undefined.
> 
> @DEFAULT-ASSUMED should typically be used in conjunction with
> @DEFAULT-UNSET, but it can be used in conjunction with either
> @DEFAULT-VALUE or normal value extraction.
> 
> For instance:
> 
>   @VARIABLE: DIST_TEST
>   @DEFAULT-ASSUMED: "do parallel"
> 
> This inserts an additional suffix to the generated man page heading
> line so it renders as follows:
> 
>   DIST_TEST     (UNSET -> "do parallel")
> 
> But indicates that the value itself is not explicitly set by the eclass
> and ebuilds should not assume it to have a value.
> 
> For instance, upon seeing such an indication, ebuild authors should
> be able to tell that doing
> 
>   DIST_TEST+=" network"
> 
> Would end up producing
> 
>   DIST_TEST=" network"
> 
> Not
> 
>   DIST_TEST="do parallel network"
> 
> This is primarily for usecases where the variable is not assigned
> anywhere in the top level file, but consuming functions imply a value:
> 
>   has "parallel" ${DIST_TEST:-do parallel}

Well, I don't think there's really a good reason to expose this
in an explicit tag. It's going to be a little bit confusing at least
(your rendering isn't immediately obvious for users), and I don't really
see the problem being solved here.

As far as I can see, it applies to quite a specific corner case, when:

a. you want to assume a default value for the variable,

b. the assumed default is simple enough to be expressed directly, i.e.
unconditional,

c. but at the same time you stil want to keep it unset in global scope
for some reason.

Even if you have a very good reason for all the three conditions to be
met, I think that in the majority of cases you will need to explain what
particular values mean.

That being the case, I don't really see an advantage of explicitly
listing default value with potentially confusing syntax when the same
problem was already solved in a readable and non-confusing way by
explaining it in the body.

In other words, I don't think that:

  DIST_TEST      (UNSET -> "do parallel")

is more readable than:

  DIST_TEST      (UNSET)
  ...
  If unset, "do parallel" is assumed.

-- 
Best regards,
Michał Górny

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

  reply	other threads:[~2017-05-01 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-30 21:38 [gentoo-dev] [PATCH] app-portage/eclass-manpages: Add support for @DEFAULT-ASSUMED kentnl
2017-05-01 16:02 ` Michał Górny [this message]
2017-05-01 21:25   ` Kent Fredric
2017-05-01 21:54     ` Kent Fredric

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=1493654576.29015.1.camel@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=kentnl@gentoo.org \
    --cc=tools-portage@gentoo.org \
    --cc=vapier@gentoo.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