On Sat, Jul 15, 2023 at 6:25 AM Ben Weidig <b...@netzgut.net> wrote:
> Hello! Hello! I'm sorry for the very late answer. It's been quite an eventful period in my life. > I have an idea for optional ChainBuilder segments, but I'm unsure if it's > even good or the right approach, so I wanted to gather some feedback first. > > The way we use Chains in our projects is that their segments are always > contributed, but the chain command, like a PageRenderLinkTransformer, > decides for itself if it's actually needed. > The surrounding context sometimes makes the segment completely unneeded, > but it's still included in the chain. > > One could argue that the contribution should be the point of the decision > if it's included, but we like it better that way, to not pollute the > Modules with to much logic, and to see all the conditions for a command to > be active in the command itself. I'm afraid I'll disagree with you here. I've never been concerned on keeping Tapestry-IoC modules simple, without much logic. As far as I know, Tapestry itself never had that goal either (but I can be wrong, of course). Sometimes configuration logic is inherently complex. Also, it's possible to move this run-or-not-run logic to the command itself making changes to ChainBuilder: create a method in your command to return whether it should be contributed to the chain or not and have your module code call it. > Usually, that's not an issue at all, it's a simple boolean check against a > Symbol maybe, and the method call is passed down the chain. In that case, I prefer the command to not be contributed, so it's never run if it's not supposed to run. You get a smaller stack trace and a little number of CPU cycles saved, a smaller chain and simpler chain logic. > What do you think? It's very rare when you propose something and I'm not immediately convinced, Ben, but I'm afraid this is the exception that proves the rule. :) > Do any od you use Chains the way we do and wish for a shallower call stack, > or am I overestimating the relevance of the "issue"? I'd say it seems to me you're trying to move some logic from T-IoC modules to commands themselves, so my humble opinion is you're overestimating the issue. Keep on with your ideas! Cheers! -- Thiago --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org