archives

« Bugzilla Issues Index

#3090 — 21.2.5.15 RegExp.prototype [ @@isRegExp ]: Misleading NOTE


21.2.5.15 RegExp.prototype [ @@isRegExp ]
The NOTE says:

(...) The absence of a @@isRegExp property or the existence of such a property whose value is null indicates that the object should (sic) is not intended to be used as regular expression object.

It suggests that an object O is intended to be used as regexp when

Get(O, @@isRegExp) is neither null nor undefined.

However, whenever @@isRegExp is used (in some algorithm of Section 21.1.3 Properties of the String Prototype Object), the test is of the form:

HasProperty(O, @@isRegExp) is true

One should either correct the NOTE, or correct the algorithms that use @@isRegExp.

That said, I would find more intuitive to use the following alternative test, but that's a detail:

ToBoolean(Get(O, @@isRegExp)) is true


> That said, I would find more intuitive to use the following alternative
> test, but that's a detail:
>
> ToBoolean(Get(O, @@isRegExp)) is true

Note also that IsConcatSpreadable Abstract Operation (Section 22.1.3.1.1) does use ToBoolean on the result of Get(O, @@isConcatSpreadable).


fixed in rev27 editor's draft

change to use ToBoolean(Get(... test fix note in 21.2.5.15


fixed in rev27 draft