Subj : Re: E4X support in mozilla? To : netscape.public.mozilla.jseng From : Shanti Rao Date : Sun Jan 02 2005 03:50 pm Brendan Eich wrote: > Shanti Rao wrote: > >> Brendan Eich wrote: >> >>> To enable it in HTML script tags, you'll have to specify >>> type="application/x-javascript;e4x=1" or type="text/javascript;e4x=1" >>> in the tag. >>> >>> /be >> >> >> >> Hi Brendan, >> >> Though terrified, I might as well make the best of it. > > Why terrified? E4X won't hurt ya! ;-) Ain't broke, don't fix. It's not hard to write a fault-tolerant XML parser in JS, and how do I know that the choices made in designing E4X are going to be the ones I desire or expect? See earlier discussion about JS2.0 for inherent reticence to embrace changes to languages that underpin complex systems. E4X appears to take a vocabulary (E) and force it onto an object model (X). I would have been a lot happier if the designers had started with a clear data processing objective, and invented a vocabulary to match. What we have now looks a lot like a camel. Consider some sample code from http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-357.pdf var twoemployees = e.employee.(@id == 0 || @id == 1); for each (var p in e..employee) { ... } What's this @ stuff? Perl is the language of obscure punctuation, not JavaScript! I just know that some newbie is going to look at that and think that they can get away with that sort of syntax for any JS object, then call me and wonder why it doesn't work. Then they'll ask how many dots are supposed to be between e and employee. And I won't have a clue? I wish that the E4X designers had put compactness of syntax secondary to clarity of purpose. >> 1. Is the version number going to change to 1.6 or similar? > > No. E4X is orthogonal to the JS version. The way to select it is with > the MIME type. The language= attribute has been deprecated by HTML 4.x > for a while now (for all that's worth ;-). There have been enough changes since 1.5rc6a that you might consider a new version number. The ATLINE option is new, and XML hooks are pervasive. I'm reading through jsxml.c, and notice that you sensibly observe that > escaping isn't necessary. Can you explain the testcase It will be interesting to figure out how namespaces work. Do namespaces go into the global string hash table? >> 2. How can I get the current SM code for E4X? Is it in the nightly >> tarballs? > > > It's in the CVS trunk so any release off the trunk (nightly builds, > didn't know we released tarballs) will have it. ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest-trunk/mozilla-source.tar.bz2 > > /be Thanks, Shanti .