more on subclassable built-ins
allenwb opened this issue · 1 comments
allenwb commented
You might want to mention that String methods that accept RegExp arguments delegate to the RegExp which means that you can do things like:
class SpecialRegExp extends RegExp {
//define a new kind of RegExp where }{ has special meaning
...
}
found = someString.match(SpecialRegExp("}{"));
lukehoban commented
I think this level of detail maybe goes beyond what's needed here. Most probably wouldn't even assume this might not work - since the delegation of behaviour here wasn't observable in any common cases before.
Going to leave this out for now.