function hashing fingerprinting as a built-in feature?

If you want a general-purpose programming language, Unison does exactly this pervasively:

Each Unison definition is some syntax tree, and by hashing this tree in a way that incorporates the hashes of all that definition’s dependencies, we obtain the Unison hash which uniquely identifies that definition.

Every Unison definition is identified by a 512-bit SHA3 hash, and is immutable—you cannot modify a definition, only create a new one. Moreover, names are stored separately from definitions, so renaming is a trivial operation, and if two people write structurally the same code with only different variable & function names, their code will share the same hash and thus be identified as the same code.

As for configuration languages, Dhall does as well:

Use Dhall’s support for semantic hashes to guarantee that many types of refactors are behavior-preserving

Since Dhall is non–Turing complete, every expression has a normal form, and the hash of this normal form can be used to identify it, so when you refactor your Dhall code, you can have strong assurance that it produces identical results.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top