The code fragments are hashed and the hash is used to refer to the code fragment. So instead of writing this code with explicit names:
let functionA = (x) => x;
let functionB = (y) => functionA(y) + 1;
You can look at the function bodies and hash them (this part is drastically simplified): `(x) => x` has a MD5 of `3bebbe46355493ecc5f6b6c9bb7e9db7`. So rather than calling `functionA` inside of `functionB` you would define `functionB` as `(y) => 3bebbe46355493ecc5f6b6c9bb7e9db7(y) + 1`. The hash of that function would be `51e272dc500e6a58889dde88ec1057fd`.To name the functions, you can assign the hashes human-readable labels.
let functionA = (x) => 3bebbe46355493ecc5f6b6c9bb7e9db7;
let functionB = (y) => 51e272dc500e6a58889dde88ec1057fd;
The author states that when you refer to a name, it will always download the latest version. So, once you define the names, your program is effectively the same as how things work in conventional languages right now, using names and not hashes.The difference is that the entire tree of functions is hashed. If `functionB` refers to `functionA` and `functionA` is updated to have different behavior, things can break. But if `functionB` calls `3bebbe46355493ecc5f6b6c9bb7e9db7` rather than `functionA` then you know that `3bebbe46355493ecc5f6b6c9bb7e9db7` will always be `(x) => x` and it won't change out from under you.
Hope this made sense, it was eliJS rather than eli5.
import foo/bar
And foo's bar library will just work in your program without you having to download it then bundle it. It will just look for foo’s bar library online when it runs (and I guess it’ll be running on an online platform, not necessarily on your own computer).
Type-safety guarantees that you won't get any side-effects where the types don't fit.
And if you really want to run untrusted code, scraps are designed to be very easy to inspect :)