What's the future of RegExp object properties?

P

Pavils Jurjans

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
 
M

Martin Honnen

Pavils said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,131
Latest member
IsiahLiebe
Top