On Wed, Aug 17, 2016 at 3:21 PM, Robert P. J. Day <rpj...@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. > 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. Cheers, Ulf -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core