Hello team,

sorry resurrect a thread[0] from 2012 but I'd like to give my POV based
on my recent experience with oak-core.

0) http://markmail.org/thread/qdvl5zz5cpkoxz3j

recently I came across the issue to frequently having to convert between
NodeState and NodeBuilders (both directions) for being able to reuse
some code (still in my head).

Discovered that while the State->Builder is essentially a noop the other
way round can be somewhat expensive.

I understand (I believe I do :)) the concept behind the separation of an
immutable tree (NodeState) and a mutable one (NodeBuilder) and the need
of two interfaces. But both of the share quite a few methods signatures
and by having those to extends a common interface I still think we keep
a good separation of concept. Having so

// the name can be changed
interface Node {}
interface NodeBuilder extends Node {}
interface NodeState extends Node {}

this would allow us to to pass in methods an instance of one or the
other where we don't really care about the current state and it could be
cleared by documentation that by using `Node` the (im)mutability aspect
is not guaranteed and to use Node(State|Builder) instead if that is a
requirement.

Any thoughts on the above?

Regards
Davide


Reply via email to