« how to make an XPage a "mashup" - Epilogue | Main| handy function for namespacing your scoped objects in server-side JavaScript »

the newest item on my XPages wishlist

Category xpages
I'm building a custom control that I hope will prove to be very useful... I'll leave its identity a mystery until it's a bit more complete, but one item I added to my "XPages wishlist" today will probably serve as a sufficient hint (I'll be requesting it later through a more official channel, but am posting it here mostly for accountability's sake to ensure that I don't forget to officially request it):

Support for recursive custom controls.

At the moment, Designer won't even let me compile a custom control if it contains a reference to itself. As a matter of fact, it pops up a MsgBox over and over and over and over and over again (in other words, on every keypress, not just at build time), reminding me that I've done something naughty until I finally manage to kill the self-reference. I understand why: simply including a custom control inside itself without specifying how many levels deep it should render would create an infinite loop and the server would go up in a sad little puff of smoke. I agree: infinite loops make Baby Jesus cry. But that's why we have the "rendered" attribute, compositeData, and viewScope - combine the first with either or both of the other two and you've got a perfect mechanism for ensuring that the control only recurses as deep as it needs to.

But in its current form the compiler prevents us from forgetting to enforce a limit, because it won't even perform the build if recursion is detected... and before you ask, no: it doesn't allow circular use either - if control A includes control B and B includes A, the same error is displayed. It knows you were trying to recurse and gets very upset.

So I'll be requesting that they replace the restriction with a warning, something scary that tries to talk the developer out of the recursion (with, of course, a "don't display this warning again" checkbox that does, in fact, prevent the warning from appearing every time) but still allows me to intentionally recurse if I think I know what I'm doing. Maybe give admins a policy that allows them to prevent recursion if their developers keep crashing the server with inadequate infinite loop checking, but disable the policy by default.

Granted, if the control I'm building were already a core control, I wouldn't need recursion... yet. But I suspect sooner or later I'd have encountered another reason for wishing it were allowed.

Comments

Gravatar Image1 - My brain is turning more "salesy" by the day. If I keep reading these blogs, it just might explode! Emoticon

I've got to get coding some of this XPages goodness!

Gravatar Image2 - Tim - excellent points made. This xPages "infinte loop" business has been on my mind too - it kind of worries me that xPages apps (which can be resource demanding) can spiral out of control in unpredictable day to day situations (loops, unexpected conditions etc).

Wonder if it would be a good idea to have some more "Admin" controls around them to help better manage things. Just imagine these things happen on your main business servers when you introduce that new xPages front intranet / public website. Thousands of people hitting the server soon as it comes back onlineEmoticon

Gives me "the fear" as they say in scotland

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Contact Me

Hire Me

What the Quote?

"Okay, now, see, that noise... that's not me."

Julian Robichaux

"When I tell you something is broken, it will be broken until I tell you it's fixed. No matter how many times you ask."

Kathy Brown

"$3.50 for a 1 GB MicroSD card with SD adapter? That's cheaper than tuna!"

Laura Tripcony

Elsewhere

Assorted Linkage

Apparel

Lotus Rocks

I write the code that makes the young girls cry

ClustrMap