You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand how key definitions are merged, but looking at the source code for MergeKeys(), I am left a little confused.
Here is my current understanding: Each KeyInfo has a merge mode, which can be any of {override, replace, augment}. Let's say I want to merge KeyInfob into KeyInfoa.
If b's merge mode is override, then all properties carrying a value in b will overwrite the respective properties in a.
If b's merge mode is augment, only properties will be added to a that don't already have a value in a.
If b's merge mode is replace, then all properties are first deleted from a and subsequently replaced by b's properties.
So far, so good. My question is: What happens to the merge mode itself? If I merge b into a, does the result inherit a's merge mode or b's merge mode?
I'm trying to understand how key definitions are merged, but looking at the source code for
MergeKeys()
, I am left a little confused.Here is my current understanding: Each
KeyInfo
has a merge mode, which can be any of {override
,replace
,augment
}. Let's say I want to mergeKeyInfo
b
intoKeyInfo
a
.b
's merge mode isoverride
, then all properties carrying a value inb
will overwrite the respective properties ina
.b
's merge mode isaugment
, only properties will be added toa
that don't already have a value ina
.b
's merge mode isreplace
, then all properties are first deleted froma
and subsequently replaced byb
's properties.So far, so good. My question is: What happens to the merge mode itself? If I merge
b
intoa
, does the result inherita
's merge mode orb
's merge mode?To make it more concrete (*):
Does
bar
's definition inherit thereplace
mode fromfoo
or not? Shouldbaz
's key definition then be equivalent tokey <ABCD> {['a', 'A']}
orkey <ABCD> {['a', 'A'], ['c', 'C']}
?What about other mode combinations? For example, what if
foo
's mode wasaugment
instead ofreplace
? And so on.Reading the source code, it looks to me like the current behavior is: When merging
b
intoa
, the result inheritsb
's mode ifb
has the modereplace
(line)a
's mode in all other casesIs this intentional? Should this be documented somewhere?
(*) I hope these examples makes sense at all, since I'm still trying to understand the format
The text was updated successfully, but these errors were encountered: