benjamingr at gmail.com
Mon Jun 29 18:39:53 UTC 2015
This is currently discussed at
Adding my comment from there to here too:
Some languages (PHP for example) do this (optional parameter with
additional parameters) so it's not unprecedented.
The question we should ask ourselves is whether it would be a significant
improvement over the user just doing a `.replace` to escape these
characters for the more fine grained cases (where the language will support
the more general one).
Also, I wonder what that options argument would look like (I think
accepting any iterable over characters would be good and would allow an
array or string or set etc).
On Mon, Jun 29, 2015 at 9:37 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
> On Jun 27, 2015, at 9:17 AM, Mark S. Miller wrote:
> > Safety over readability please. If there is a single fully escaped form
> that is safe to use in all the expected contexts, let's choose that. The
> results of RegExp.escape are not very readable anyway, and rarely read. So
> compromising safety for some contexts in exchange for incremental
> readability improvements of something that won't be read is not a good idea.
> > If there is not a clearly most escaped form that is safe in all expected
> contexts, then first, let us enumerate all the relevant contexts and the
> escaping demands of each.
> Alternatively, an optional options object argument could be used to adapt
> a single 'escape' function to differing use case requirements.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss