Feel the power of the functional programming style, Luuuke. In DOM you can use XSL, and in XLinq you can use either XSLT or functional construction to transform from one tree to another without imperative manipulation. That will avoid the problem. Or you could use non-lazy tree navigation (no NodeLists in DOM or IEnumerables in XLinq) to locate data to modify.
I tell ya… Everytime I read another article, blog entry, or watch a Channel 9 flick on LINQ, the more excited I become. To see such a distinct effort for LINQ to “buddy up” with XSLT just makes my little XMLHacker heart go “pitter patter, pitter patter.”
NOTE: Don’t bother… As soon as I’m done writing this I’m taking myself out back and kickin’ my own a$$ for that one. ;)
Okay then, so lets add a little more fun to the mix, shall we?
You don’t need to be scared about this functional consturction and transformation stuff just because “introductory” articles on the subject start talking about Haskell, monads, lambda calculus, etc. in about the second paragraph. With the help of our friendly local ex-professors and Haskell geeks Dr. Meijer and Dr. Lämmel, I have learned to stop worrying and love monad comprehensions; we believe thatVB9 / C# 3.0 and the LINQ technologies will help bring functional programming to the masses, whether or not they know that they are doing it. The first step is to understand the power of language integrated QUERY for working with data and the functional construction approach to reshaping it rather than modifying it in place, even though C# 3.0 and XLinq still support traditional imperative data manipulation for all sorts of pragmatic reasons…
I’ve said it before, and I’ll say it again…
There are some folks that just get it.
While the closest I *have ever* AND *will ever* come to gaining any level of association with the term “Dr.” starts and ends with my first two initials, I can promise you one thing… You don’t HAVE to be a Dr. Erik Meijer, a Dr. Ralf Lämmel, a Dr. Michael Kay, a Dr. Michael Rys, or even a Dr. Daniela Florescu to truly understand just how powerful, and in the same breath, simple, functional programming truly is. While you many never reach the same level as Mike Champion, come anywhere close to achieving that in which Anders Hejlsberg has accomplished, or have the ability to take on Dimitre Novatchev in a [pick your poison] coding challenge, you *CAN* understand the reason why these same group of folks enjoy life with a smile, choosing to write code because it *truly is fun*, instead of just writing code because its their job, but not their passion.
In short: The passion will come when the coding is fun(ctional.) ;) :D (don’t worry… After I’m done with the first round of a$$ whoopin’, I’ll add in a second round for this last part as well. ;)
But before I do that…
If you’re one of those folks in whom look at functional programming methodologies and related languages and begin to well up with tears from the agony that you feel awaits you, I can assure you that once you realize just how powerful and just how easy functional programming methodologies truly are, you may very well become the next [fill in the blank with the folks from above and/or other folks in whom are at or near their same level — and there are a TON of folks who are obviously missing from this list], as once the light clicks… Well, it’s all just smiles and happy thoughts from that point forward.
And if even if you don’t become one of these same folks…
At least you’ll have fun trying. And *THAT*, my friends, is what matters most.
[I’m going, I’m going… ;)]