Re:Moving Beyond Type Systems
by sparkie on Friday May 31, 2024 @11:58PM
(#40542761)
It doesn't solve the referential transparency problem. To be referentially transparent, the buffer would need to be fixed in size, and have all of its data input prior to being used the first time. Essentially, it would akin to passing a read-only file as a command line argument to `main`.
[ Parent
| on HN ]
While preloading would obviously solve pretty much everything and make all execution trivially deterministic: how is forcing all input-reading to provide an offset not referentially transparent? Particularly when all input is done this way, since e.g. checking the current time is I/O and would need to pass last-result values around to maintain its "state" as well.
The problem is if you pass an offset which the user has not yet input to, you're either going to have to abort or return an error of some kind. If the user inputs to this location later, and you read from it, you've broke referential transparency because you called the same function with the same arguments twice and got a different result.