archives

« Bugzilla Issues Index

#4165 — Move Symbol.split, Symbol.match etc. into a sub-object of Symbol


Probably not worth posting this in March 2015, but w/e.

In short: this is solely a built-in name quibble. I think the RegExp double-dispatch symbol names are too esoteric to be put directly into, and thus pollute, the Symbol static property namespace. I think they need to be ensconced in a separate sub-object inside Symbol which better hints at their meaning and purpose to end-users.

Primary suggestion:

Symbol.RegExp = {} (a bare object, similar to the deferred Reflect.Realm)

Symbol.split -> Symbol.RegExp.split
Symbol.search -> Symbol.RegExp.search
Symbol.replace -> Symbol.RegExp.replace
Symbol.match -> Symbol.RegExp.match

Alternative (which moves them off Symbol altogether):

Symbol.split -> RegExp.Symbol.split
Symbol.search -> RegExp.Symbol.search
Symbol.replace -> RegExp.Symbol.replace
Symbol.match -> RegExp.Symbol.match

Full justification: https://esdiscuss.org/topic/does-symbol-split-symbol-search-etc-have-to-be-in-the-symbol-namespace.

Thanks for reading anyway.


It's to late for this sort of change.

The thread shows that there are multiple options on a "better" naming or placement of this properties and there is no time available to to discuss alternatives.