unison icon indicating copy to clipboard operation
unison copied to clipboard

output of dependents is confusing

Open stew opened this issue 2 years ago • 2 comments

dependents foo gives you a mixture of global and local results with no way to distinguish them.

here is a transcript that show's what I mean:

```ucm
.> builtins.merge
```

```unison
a.theThing = "this is the thing that everyone can't get enough of"
a.subNamespace = match theThing with
  a -> a
otherRootNamespace = theThing ++ " "
```

```ucm
.> add
.a> dependents theThing
```

the output I get is:

```ucm
.> builtins.merge

  Done.

```
```unison
a.theThing = "this is the thing that everyone can't get enough of"
a.subNamespace = match theThing with
  a -> a
otherRootNamespace = theThing ++ " "
```

```ucm

  I found and typechecked these definitions in scratch.u. If you
  do an `add` or `update`, here's how your codebase would
  change:
  
    ⍟ These new definitions are ok to `add`:
    
      a.subNamespace     : Text
      a.theThing         : Text
      otherRootNamespace : Text

```
```ucm
.> add

  ⍟ I've added these definitions:
  
    a.subNamespace     : Text
    a.theThing         : Text
    otherRootNamespace : Text

.a> dependents theThing

  Dependents of #5bpk18etq2:
  
       Name               Reference
    1. otherRootNamespace #n26051kd40
    2. subNamespace       #vi4oumi3rg
  
  Tip: Try `view 1` to see the source of any numbered item in
       the above list.
```

I would prefer that the otherRootNamespace entry be prefixed with a . since it is absolute not relative

stew avatar Aug 23 '22 03:08 stew

perhaps "dependents" isn't the right target for this bug. this is something that we should also be doing in the pretty printer. and I don't know how things work to say if that means I should file a separate bug against the pretty printer or if they are both relying on the same mechanism, but I feel like all "out of namespace" names should be absolute not relative

stew avatar Aug 23 '22 03:08 stew

@stew It shouldn't give global results anymore, does this do the trick?

.> builtins.merge

  Done.

a.theThing = "this is the thing that everyone can't get enough of"
a.subNamespace = match theThing with
  a -> a
otherRootNamespace = theThing ++ " "

  Loading changes detected in scratch.u.

  I found and typechecked these definitions in scratch.u. If you
  do an `add` or `update`, here's how your codebase would
  change:
  
    ⍟ These new definitions are ok to `add`:
    
      a.subNamespace     : Text
      a.theThing         : Text
      otherRootNamespace : Text

.> add

  ⍟ I've added these definitions:
  
    a.subNamespace     : Text
    a.theThing         : Text
    otherRootNamespace : Text

.> dependents theThing

  Dependents of: theThing
  
    Terms:
  
    1. otherRootNamespace
    2. subNamespace
  
  Tip: Try `view 2` to see the source of any numbered item in
       the above list.

.a> dependents theThing

  Dependents of: theThing
  
    Terms:
  
    1. subNamespace
  
  Tip: Try `view 1` to see the source of any numbered item in
       the above list.

aryairani avatar Jun 15 '24 23:06 aryairani