On Sunday, February 15, 2015 at 10:01:58 AM UTC+1, Jeff Walden wrote: > On 02/14/2015 08:43 PM, Boris Zbarsky wrote: > > On 2/14/15 11:06 PM, obastemur wrote: > >> On Friday, February 13, 2015 at 5:06:31 PM UTC+1, Boris Zbarsky wrote: > >>> Note that this does not do the same thing as obastemur's proposed API. > >>> Whether it does what he actually wants is an interesting question > > Moreover: whether *any* of these APIs does what is really wanted, is an even > better question. ES6^H2015 includes an IsRegExp abstract operation. Perhaps > that's what we should be exposing, not an exact-class sort of check that > exists nowhere in the standard. I would certainly be hesitant at this point > to expose anything that doesn't have identical API to the standard method, > even if in the short run it might have a semantically-different > implementation. > > Jeff > > P.S. -- For elucidation, the algorithm in the February 12 draft is this: > > > 7.2.8 IsRegExp(argument) > > > > The abstract operation IsRegExp with argument argument performs the > > following steps: > > > > 1. If Type(argument) is not Object, return false. > > 2. Let isRegExp be Get(argument, @@match). > > 3. ReturnIfAbrupt(isRegExp). > > 4. If isRegExp is not undefined, return ToBoolean(isRegExp). > > 5. If argument has a [[RegExpMatcher]] internal slot, return true. > > 6. Return false. > > Salient differences at a glance are that this algorithm is 1) pluggable, and > 2) would throw a TypeError when used upon a revoked proxy. So it is an > absolute certainty that this operation expressed in JSAPI terms must return > both a boolean succeeded/failed value, and also a conditionally-valid (if > succeeded) wasRegExp boolean value.
@bzbarsky, I think JS_ObjectIsRegExp should do the work. Better I unwrap some stuff on my end instead extending public API with another non-standard function. Thanks _______________________________________________ dev-tech-js-engine-internals mailing list dev-tech-js-engine-internals@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals