Reply to thread

So if you update XenForo or a 3rd-party style, are you supposed to keep a record of how many times a TM has been applied and then verify those numbers on each update to make sure it hasn't been applied somewhere accidentally?


Regardless, a 3-way merge is much more semantic (and therefore accurate) because it has knowledge of the source tree and the whole file. If something can't be merged without a conflict (the equivalent to a well-written, best-case regular expression failing to apply because of changes), you can resolve the conflict intelligently right there with the full source of all relevant files at your disposal.


The problem with using regular expressions to make modifications like this is that the developer or user has to decide how much context to use (in other words, how much do you try to match in your regular expression?).


Use too much context (an exaggerated example would be matching the entire template), and you risk unrelated changes breaking your template modification because the regex no longer matches. Use too little context, and you risk the modification being applied in areas you don't want it to.


Doing a 3-way merge, on the other hand, is much more intelligent! Because it has access to the full source of the ancestor and both child derivatives (I'm talking about a tree as in version history, not the XenForo template system), it can figure out exactly what the differences are and apply changes only where they need to be applied, while leaving other things alone and minimizing conflicts.


The only advantage a regular-expression-based template modification system has over version history/control and a 3-way merge is that changes can be applied across multiple templates simultaneously with only one modification. However, I can't see a common use case for this when developing styles - most changes are very specific and large numbers of changes that need to be repeated across templates would raise concerns that things aren't very DRY.


I can see how this could be very useful for addon developers, although in my mind the jury's still out on whether this is actually a better solution than well-thought-out template hooks (for the reasons John mentioned earlier in the thread: style developers can guarantee that all the template hooks will always be there in the place they need to be, but depending on how addon developers write their regex's, it could be very easy to break an addon's template modifications).


However, for style developers, template modifications are a half-assed solution to what we all really want: proper version control and 3-way merging. A 3-way merge is an all-around technically better solution than template modifications. If anyone still doesn't understand why, I would suggest reading up on version control and difference merging - it's very cool stuff.


- Erik


Back
Top Bottom