Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: workers/40626 (commit 6c476c22) causes multiple test failures



On Feb 28,  9:51pm, Daniel Shahaf wrote:
}
} I noticed that they're equivalent, but I think it's more readable to use
} += when setting values of some options and = when setting values of all
} options.  That's because using = without specifying all options violates
} the following invariant of hashes:
} 
}     local -a a=(...)
}     local -A hash=( $a )
}     (( $#a == $#hash ))

I'm presuming you mean (( $#a == 2 * $#hash )) ... but that's not an
invariant in the first place.

    local -a a=( a 1 b 2 a 3 b 4 )
    local -A h=( $a )

Anwyay there are several special hashes that don't obey normal rules
for hashes (which is why they're special), but I will concede your
readability point.



Messages sorted by: Reverse Date, Date, Thread, Author