Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement "incremental lists" #12

Closed
2 tasks
mhuesch opened this issue Apr 5, 2021 · 2 comments
Closed
2 tasks

implement "incremental lists" #12

mhuesch opened this issue Apr 5, 2021 · 2 comments
Assignees

Comments

@mhuesch
Copy link
Contributor

mhuesch commented Apr 5, 2021

currently:

#[derive(Clone)]
pub enum Value {
    ...
    VList(Vec<Value>),
    ...
}

change to

#[derive(Clone)]
pub enum Value {
    ...
    VList(Iterator<Item = Value>),
}
  • figure out what places in the codebase clone Value
  • figure out how to clone iterators (is it possible?)
@mhuesch mhuesch self-assigned this Apr 5, 2021
@mhuesch
Copy link
Contributor Author

mhuesch commented Apr 5, 2021

as context:

if we clone the iterator "fully" (as in, the code inside of the iterator body is cloned) then we will duplicate effectful actions which might be enclosed in the iterator body. for example, we might read from Holochain to get the next value, or we might pull from the network 😱. so if we have 2 copies of the iterator, they would do these effectful actions twice. this could be a problem...

one way to mock-up "purity" (or rather, only singular execution of effects) is to have a cache which saves values once they are pulled from the iterator. thus, once we duplicate an iterator, it would only ever read from the cache, so the effect only occurs once.

in a recent meeting we decided that it's ok to duplicate effects for Holochain, so I dropped this. documenting it here in case we want to revisit in the future.

@mhuesch
Copy link
Contributor Author

mhuesch commented May 23, 2021

closing this issue in favor of the approach of #25.

@mhuesch mhuesch closed this as completed May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant