Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #210.
To avoid excessive prefix length, I've rolled
__name__
and template count into the hash, which I've limited to 40 bits (5 bytes). I've been reading up on the birthday paradox. I think this is more than enough hash space for typical gensym usage, and pretty much don't expect collisions ever, but maybe there's some subtle argument for greater length. It would not be too difficult to bump this up to 6 or 8 bytes using the same format, although that would take more characters to encode. The format would not have changed, so it wouldn't require as much of a change in the docs, and I could keep the old examples.I've encoded the hashes using base32, which is 5 bits per character, so they typically take 8 characters, plus the 5-character
_Qz{}z_
overhead needed to mark them as gensyms. Base64 uses non-identifier characters and doesn't save all that many. (Base32 is only 2 characters shorter than hex.) If we turn out to need really long hashes I'd consider higher Unicode to avoid excessive printed gensym length, but this seems complicated. (UUID4 only has 122 bits of space, which base32 could encode in 26 characters. There's just no way we'd need to default to more than that.)