Message from JavaScript discussions
May 2017
—
var alg = new Strategy(iddfs);
alg.addObserver(observerCallbacks.diff);
alg.addObserver(observerCallbacks.clone);
alg.dependency = {
originalRoot: myObj,
returnDiff: false,
};
return alg.run(obj1Root, searchRoot);
Managed to built an algorithm strategy framework, but I think it breaks some rules!! All the strategies pre-empt the search algorithm generator and each other mid execution, by directly changing it's state...
— Is this an okay exception? My surface area is the iterator protocol, so next
and value
— I posted in here earlier when it was not so fleshed out, but now I got it working! But so shamefully breaking encapsulation!
— What does new Strategy
mean?
— Oh god
— I'm not sure what this means 😅
— It is the strategy design pattern
— In this case a strategy interfaces with an iterator/generator yielding that state object
— It is tightly coupled with it
— Async iteration is confirmed in a future version of js now btw
— Https://github.com/tc39/proposal-async-iteration