Hacker News new | ask | show | jobs
by SimHacker 4690 days ago
You're trying to oversimplify something that's just not that simple. When you project something down to a lower number of dimensions, you lose something. In this case, you lose determinism. Your code can break depending on the input. E4X tried to do that (blurring the distinction between XML and XMLNode), and failed. It might look good in oversimplified examples on blog posting, but it's a trap waiting to be sprung when used with real world data.
1 comments

Yes, code that's unprepared for variable input can break when input varies. So use code that is prepared for it, like each().

And thank you for your anecdote, but i have never and will never stop doing something merely because some guy on the internet points out that some completely other person in a different context failed to pull it off.

How else can i spell this out... you do not need to worry about the distinction between nodes and node lists, if you just use each(). It's a proxy function that deals with the abstraction for you, just like jQuery's wrapper object does.

YOU. DO. NOT. NEED. AN. OBJECT. TO. HAVE. AN. ABSTRACTION.

Thank you and good night.