You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 4, 2021. It is now read-only.
functional style dictates that all state mutations should return a new instance of the underlying datastructure (which can be accomplished by mapping into a tree somewhere). the mutable interfaces should be changed to accommodate this pattern (though not necessitate it) by adding return values that are of the interface mutator type.
The text was updated successfully, but these errors were encountered:
sdboyer
changed the title
Enable functional-like behavior with mutables by having the methods return 'self'
Enable functional-like behavior with 'persistent' interfaces
Apr 28, 2014
on further reflection, it's really not possible to do this in a way that's fully consistent with the existing Mutable interfaces; adding return values would introduce an inconsistency that should not be inflicted on client libs, as the return value from an imperative-style mutable would be the same pointer as the original method receiver, but the return value from a functional-style mutable would be a different pointer.
consequently, a Persistent set of interfaces is a better approach; these would add the return values on methods of the same name as what's already on Mutable. thus, it'd be impossible to implement both the persistent and mutable interfaces at the same time.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
functional style dictates that all state mutations should return a new instance of the underlying datastructure (which can be accomplished by mapping into a tree somewhere). the mutable interfaces should be changed to accommodate this pattern (though not necessitate it) by adding return values that are of the interface mutator type.
The text was updated successfully, but these errors were encountered: