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

gens should return an independent copy #10

Open
kalmarek opened this issue Mar 15, 2021 · 2 comments
Open

gens should return an independent copy #10

kalmarek opened this issue Mar 15, 2021 · 2 comments

Comments

@kalmarek
Copy link
Owner

Slogan:

The modification of the result of gens(G) shall not modify the parent object.

@thofma
Copy link

thofma commented Mar 23, 2021

Then there should be a function or a version of gens which does not copy :)

Maybe with a keyword argument a la gens(G, copy = false)?

@blegat
Copy link
Contributor

blegat commented Mar 24, 2021

Maybe gens could return an immutable version of the generator. E.g.

struct ImmutableVector{T, V}
    data::V
end
Base.iterate(...) = ...
Base.length(...) = ...
Base.push!(...) = error(...)
Base.setindex!(...) = error(...)

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

3 participants