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
The implementation of a method like addAndFind is error prone since it's easy to forget to place newSelf. everywhere it should be used, and is a natural fit for mutual tail recursion, since we can fake this = newSelf by calling a method on newSelf immediately.
There are definitely some work-arounds here, but none of them are nearly as elegant, and there isn't an intuitive reason why this shouldn't work, since it's essentially a resugaring from something that tailrec was happy with.
The text was updated successfully, but these errors were encountered:
I'm currently writing a program that utilizes copy-on-write semantics, which means writing a lot code that looks something like this:
The implementation of a method like
addAndFind
is error prone since it's easy to forget to placenewSelf.
everywhere it should be used, and is a natural fit for mutual tail recursion, since we can fakethis = newSelf
by calling a method onnewSelf
immediately.There are definitely some work-arounds here, but none of them are nearly as elegant, and there isn't an intuitive reason why this shouldn't work, since it's essentially a resugaring from something that
tailrec
was happy with.The text was updated successfully, but these errors were encountered: