Feature Request: Hashed Based Assertion

Nordlöw via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 27 00:26:40 PST 2015

On Thursday, 26 November 2015 at 11:12:07 UTC, tcak wrote:
> What is needed is to be able to bind a hash value to any block 
> with a name.

I've thought about this too in the past and asked on the forums 
but I haven't gotten any response.

It is possible. The problem is easier in dynamic languages. See 
for instance a the following solution in a specific Python 
runtime here: http://pgbovine.net/incpy.html

`hashOf` is for AAs not for content digests.

I believe the only realistic solution to this problem is to 
implement a specific pass in the D compiler that recursively 
calculates hash-digests (hash-chains) for all the code and data 
involved in a function call. It should probably only work for 
pure functions. AFAICT, it is possible but it's far from easy to 
get 100% correct :)

DMD pull requests should be very welcomed, at least by me ;)

See also: https://en.wikipedia.org/wiki/Hash_chain

More information about the Digitalmars-d mailing list