3
lorentz
1y

Adding opportunistic move to a large recursive tree processor is not a fun exercise, I would advise anyone who intends to dabble in interpreters to design with opportunistic move from the get go.

Comments
  • 1
    I mean it is fun but it takes fucking forever and forces you to touch everything twice at least until you figure out exactly what can be move and what needs to be copy.
  • 1
    Opportunistic move is when refcounted resources are handled differently whenever the current instance is the last reference to the shared resource. It can cut down on allocations and it's not that hard, but to really make it worthwhile you have to avoid cloning refcounting pointers whenever possible, which means that many functions which would ordinarily not return their argument have to support this if the calling context requires it.
Add Comment