By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

What's the future of RegExp object properties?

P: n/a
Hallo,

I yesterday was browsing the book, JavaScript The Definitive Guide
(4th ed), which is, unquestionably, the best reference book for JS. To
my surprise, I didn't find any documentation about the static
properties of global RegExp object, ie, RegExp.lastMatch,
RegExp.leftContext, RegExp.rightContext, and all those RegExp.$x
properties. I lloked up the ECMA-262 PDF and to my surprise realized
that they are not included into the standard.
I don't wuite know the reasons, why it is done so, I may guess that
it's because of their awkward namespace. Still, that functionality is
specified in core JavaScript 1.2 (at least JavaScript the Definitive
Guide 3rd ed states so), and I doubt that such features would be taken
off from the JavaScript standard in future. It's somewhat bitter that
the 4th edition focuses on ECMA standard rather than JavaScript.
But now, I am quite concerned about the future of those RegExp object
properties. I there some info about their possible inclusion in the
ECMA standard? Is it now 'deprecated' to use them, and coders should
use workarounds?

Thanks,

-- Pavils
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


Pavils Jurjans wrote:
I yesterday was browsing the book, JavaScript The Definitive Guide
(4th ed), which is, unquestionably, the best reference book for JS. To
my surprise, I didn't find any documentation about the static
properties of global RegExp object, ie, RegExp.lastMatch,
RegExp.leftContext, RegExp.rightContext, and all those RegExp.$x
properties. I lloked up the ECMA-262 PDF and to my surprise realized
that they are not included into the standard.
I don't wuite know the reasons, why it is done so, I may guess that
it's because of their awkward namespace. Still, that functionality is
specified in core JavaScript 1.2 (at least JavaScript the Definitive
Guide 3rd ed states so), and I doubt that such features would be taken
off from the JavaScript standard in future. It's somewhat bitter that
the 4th edition focuses on ECMA standard rather than JavaScript.
The standard for JavaScript is the ECMAScript standard which is
currently in edition 3. This is the first edition to introduce RegExp at
all, and as you have found out the static properties you list above are
not defined in that standard. Thus there is no need to "take the
features off from the Javascript standard in the future", they are not
part of the standard.
But now, I am quite concerned about the future of those RegExp object
properties. I there some info about their possible inclusion in the
ECMA standard? Is it now 'deprecated' to use them, and coders should
use workarounds?


As RegExp implementations with those properties existed when ECMAScript
edition 3 was written I am sure these properties were intentionally not
made part of the standard and therefore I guess there is no intention to
add them in later editions.
As for the reasons I guess it is akward that instance methods have the
side effect of changing static properties. Of course it would have been
nice to have things like rightContext as a property of the result of
exec but somehow it is not part of the standard.
As for using those properties if you want to write cross browser
JavaScript don't do it, for instance Opera 7 (tested with 7.20) doesn';t
implement rightContext at all.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.