public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: Ulf Magnusson <ulfalizer@gmail.com>
Cc: OE Core mailing list <openembedded-core@lists.openembedded.org>
Subject: Re: subtle weirdness when you combine "_append" with "+="?
Date: Wed, 17 Aug 2016 10:23:59 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.20.1608171020570.13500@ca624034.mitel.com> (raw)
In-Reply-To: <CAFkk2KSt7rLiTim2oiHZMVKezVgtuegSraR0ePQWmdBhxbd6SQ@mail.gmail.com>

On Wed, 17 Aug 2016, Ulf Magnusson wrote:

> On Wed, Aug 17, 2016 at 3:21 PM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> > On Tue, 16 Aug 2016, Khem Raj wrote:
> >
> >   ... big snip ...
> >
> >> the _append/_prepend in conjunction with += is a undocumented
> >> behavior however, I do not see it as much a side effect. But in
> >> future bitbake may silently change its behavior, so I agree its
> >> always good to stay in safe waters.
> >
> >   so just to finalize this discussion, my thoughts on a reasonable and
> > meaningful standard for append/prepend/etc/etc would be to *always*
> > use the "mathematical" operators +=/.=/=+/=. except in two situations:
> >
> >   1) when parsing *must* be delayed until the end, or
>
> I agree as long as that *must* also includes the kind of situation
> described for foo.bbclass in
> https://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#override-style-operation-advantages.
> I think you ought to follow the principle of least surprise.

  agreed. i guess a simpler way to state it is that one should never
use "_append" unless it's necessary. that pretty much covers all
situations.

> >   2) when combining the operation with an override (for which i'm
> >      quite sure there is no equivalent when using +=, etc, right?)
> >
> > i'm a big fan of simplicity, in the sense that, if an append operation
> > does not *require* "_append", it shouldn't use it. because if i see an
> > expression:
> >
> >   VAR_append = "..."
> >
> > then i immediately wonder if there is a *reason* for using "_append"
> > rather than "+=" or ".=", or if that is just the developer's personal
> > preference. and i really, really, really hate having to guess.
> >
> >   oh, and of course, never, ever combine "_append" with "+=" or ".=".
> > does that sound like a reasonable coding style?
>
> Sounds reasonable to me. Using _append rather than += can also be
> a bug in certain situations. For example, the following does not
> guarantee that " value1 value2" appears right after "--flag":
>
> FLAGS = "--flag"
> FLAGS_append = " value1"
> FLAGS_append = " value2"
>
> Any earlier FLAGS_append value would appear before those two.

  i don't see that as a "bug"; it's exactly the way it *should*
operate. the above is more an example of someone not *understanding*
how those operators work.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



      reply	other threads:[~2016-08-17 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16 14:02 subtle weirdness when you combine "_append" with "+="? Robert P. J. Day
2016-08-16 14:46 ` Ulf Magnusson
2016-08-16 15:49   ` Robert P. J. Day
2016-08-16 15:56     ` Ulf Magnusson
2016-08-16 16:39       ` Khem Raj
2016-08-17 13:21         ` Robert P. J. Day
2016-08-17 14:14           ` Ulf Magnusson
2016-08-17 14:23             ` Robert P. J. Day [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=alpine.LFD.2.20.1608171020570.13500@ca624034.mitel.com \
    --to=rpjday@crashcourse.ca \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ulfalizer@gmail.com \
    /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