by workincog · 9y ago · 0 comments
Meanwhile the open source project he links to has an implementation that is hundreds of lines of template magic that I gave up on interpreting.
I've dealt with codebases like this and I strongly recommend against using this kind of arcane template incantations in production. It becomes an impenetrable fog for newbies, and a morass for veterans with something to prove.
~Either() {
if(isLeft) {
leftValue.~L();
} else {
rightValue.~R();
}
}
Which does explicitly call the destructors. (Obviously, if you only were referring to his eight-line toy version of Either for the blog, please forget my comment.)[EDIT: re-reading your comment once more, I see you did indeed mean the blog implementation; please ignore this comment.]
[EDIT2: BTW, it seems the author is "affiliated" with that LoopPerfect/neither implementation.]
[1] https://github.com/LoopPerfect/neither/blob/master/neither/i...