3 ms·
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 inpu
by sparkie 2y ago
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`.
- Groxx 2y agoWhile 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.
- sparkie 2y agoThe 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.
- Groxx 2y agoWhy would you have to error, or retain the offset? Block until that input exists, and/or return a higher offset to use for the next call - perhaps add the length of error message so you essentially can't guess and have to show the error has been checked. It doesn't have to match the underlying bytes, it's just a progress marker.