unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.67k stars 266 forks source link

Allow alias.term and alias.type to use project:path syntax #5043

Open ceedubs opened 1 month ago

ceedubs commented 1 month ago

The fork command supports a syntax like fork project/branch:path. But alias.term and alias.type don't support the same syntax:

@cloud/nimbus/verify-service-owner-4> alias.type /verify-service-owner-3:JobContext.UserHandle JobContext.UserHandle

  1:2:
    |
  1 | /verify-service-owner-3:JobContext.UserHandle
    |  ^
  unexpected 'v'
  expecting '.', end of input, hash (ex: #af3sj3), or operator (valid characters: !$%&*+-/:<=>\^|~)

A workaround is to use names to get the hash and then pass the hash as the first argument.

hojberg commented 1 month ago

Whats the use case for this? Seems weird to me to have an alias pointing at a different branch or project. I guess this is a our way to copy? Hmmm.

ceedubs commented 1 month ago

@hojberg here are a couple of use-cases:

And yeah this is basically a copy; but in Unison you don't really copy a definition; you just add a new name as a pointer to the definition.