News for hackers. Stuff that matters.
Re:Show HN: ScrapScript – The Sharable Programming Language by evilspammer on Friday April 28, 2023 @10:40PM (#35749521)
To over simplify & risk that I misunderstand, it is "just" content addressible storage for code.

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.

There are no comments on this comment yet.