mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
Use full length hashes for jit names
This should avoid any possibility of picking conflicting names for distinct functions. I'm not aware of any actual examples of this, but it could in principle happen. I decided to use the full length hashes because picking just-long-enough names starts to become very cumbersome when doing dynamic loading. You need to keep track of all your past choices, not just the choices for the module you're loading, because the one you're loading could refer to things in previously loaded modules. It would be possible to use shorter names in a compile-time context, since you have all the names up front. But you'd still have to remember _those_ for runtime loading, and it seemed not worth it. This doesn't include any custom error formatting, because I'd like to see error messages in the wild before doing anything, but if they're too verbose, it's possible to override the Racket error reporting to produce shorter names there, rather than generating them up front.
This commit is contained in:
parent
9739cfedb2
commit
a1ef6a76d1
@ -221,10 +221,11 @@
|
||||
[(unison-termlink-builtin name)
|
||||
(string-append "builtin-" name)]
|
||||
[(unison-termlink-derived bs i)
|
||||
(let ([hs (bytevector->base32-string bs #:alphabet 'hex)]
|
||||
[po (if (= i 0) "" (string-append "." (number->string i)))])
|
||||
(let* ([hs (bytevector->base32-string bs #:alphabet 'hex)]
|
||||
[tm (string-trim hs "=" #:repeat? #t)]
|
||||
[po (if (= i 0) "" (string-append "." (number->string i)))])
|
||||
(string->symbol
|
||||
(string-append "ref-" (substring hs 0 8) po)))]))
|
||||
(string-append "ref-" tm po)))]))
|
||||
|
||||
(define (ref-bytes r)
|
||||
(sum-case (decode-ref r)
|
||||
|
@ -5,7 +5,7 @@ Next, we'll download the jit project and generate a few Racket files from it.
|
||||
|
||||
```ucm
|
||||
.> project.create-empty jit-setup
|
||||
jit-setup/main> pull @unison/internal/releases/0.0.15 lib.jit
|
||||
jit-setup/main> pull @unison/internal/releases/0.0.16 lib.jit
|
||||
```
|
||||
|
||||
```unison
|
||||
|
@ -20,9 +20,9 @@ Next, we'll download the jit project and generate a few Racket files from it.
|
||||
|
||||
🎉 🥳 Happy coding!
|
||||
|
||||
jit-setup/main> pull @unison/internal/releases/0.0.15 lib.jit
|
||||
jit-setup/main> pull @unison/internal/releases/0.0.16 lib.jit
|
||||
|
||||
Downloaded 15060 entities.
|
||||
Downloaded 15091 entities.
|
||||
|
||||
✅
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user