Skip to content

Do we need MutationPolicy? #32

@tkf

Description

@tkf

Continuing the discussion from #31 (comment)

I thought it was useful for generic programming that supports immutable and mutable types simultaneously. But I never needed it in practice.

Same here :) Meaning that I thought it'd be useful but have never used yet. I'm hoping to use it soon for writing generic code for mutable arrays and StaticArray. So I thought I'd fix it for 0.7. But I'm not entirely sure if I can write such code without handling the difference manually in the end.

Also, for Setfield.jl to be usable in my code (especially with Julia 0.7), dot-fusions like .= and .+= also have to be implemented which would add more complexity.

OTOH I implement custom lenses from time to time and then the MutationPolicy machinery just adds annoying complexity.

Do you mean it's cumbersome to write policy-aware lens? Thinking out loud, how about putting the policy in Lens type? This way, you can define policy-unaware lens. Additional benefit would be that you can compose Lens{EncourageMutation} and Lens{ForbidMutation} in arbitrary nested way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions