- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Wed, 04 Jul 2012 12:09:58 +0200
- To: public-script-coord@w3.org
Hi, WebIDL currently doesn't support RegExp values. However, we are working on a feature for Opera's extensions where the ability to set a value of a dictionary property to a regular expression would be useful. I believe most other built-in ECMAScript objects can be represented in WebIDL. RegExp seems to be the only built-in ES5 object that can't. Our use case is for a dictionary that looks something like this: dictionary Properties { (DOMString or RegExp) pattern ... } When it's the value is set to a DOMString, the match is a simple keyword match. When it's a regular expression, it can handle more complicated pattern matching. Possible solutions we could use given the current state of the spec are to either: 1. Use (DOMString or object) and then handle evaluating it as a regular expression in prose. 2. Define the pattern as a DOMString only, which when set to an ES RegExp value, will stringify as "/.../" and can then be parsed again. This would require carfully differentiating between strings intended for keyword matches and strings intended to be regular expressions. 3. Accept it as a wilful violation and move on, which isn't optimal. Is there any reason to leave RegExp unsupported in WebIDL? -- Lachlan Hunt - Opera Software http://lachy.id.au/ http://www.opera.com/
Received on Wednesday, 4 July 2012 10:10:30 UTC