mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-10 20:00:27 +03:00
1.3 KiB
1.3 KiB
This transcript shows how the pretty-printer picks names for a hash when multiple are available. The algorithm is:
- Names that are "name-only" come before names that are hash qualified. So
List.map
comes beforeList.map#2384a
and alsoaaaa#xyz
. - Shorter names (in terms of segment count) come before longer ones, for instance
base.List.map
comes beforesomelibrary.external.base.List.map
. - Otherwise if there are multiple names with a minimal number of segments, compare the names alphabetically.
.> alias.type ##Nat Nat
.> alias.term ##Nat.+ Nat.+
a = b + 1
b = 0 + 1
Will add a
and b
to the codebase and give b
a longer (in terms of segment length alias), and show that it isn't used when viewing a
:
.a> add
.a> alias.term b aaa.but.more.segments
.a> view a
Next let's introduce a conflicting symbol and show that its hash qualified name isn't used when it has an unconflicted name:
.> fork a a2
.> fork a a3
c = 1
d = c + 10
.a2> add
.a2> alias.term c aaaa.tooManySegments
c = 2
d = c + 10
.a3> add
.a3> merge .a2 .a3
At this point, a3
is conflicted for symbols c
and d
, but the original a2
namespace has an unconflicted definition for c
and d
, so those are preferred.
.> view a b c d