03:04
<devsnek>
fwiw its sort of "planned" to have fetch in node, there's just a lot of stuff to do and not a lot of people willing to do it. (jasnell's work on streams, for example)
03:50
<sideshowbarker>
Can somebody please step in on https://github.com/mdn/content/issues/11743 with a comment to confirm what the argument order is for the replacer function for String.prototype.replace()?
03:51
<sideshowbarker>
Is it (match, offset, string) or is it instead (match, string, offset)?
03:52
<sideshowbarker>
see comments at https://github.com/mdn/content/issues/11743#issuecomment-1012831082 and https://github.com/mdn/content/pull/11770#pullrequestreview-845997341
03:56
<jmdyck>
looks like neither
03:57
<sideshowbarker>
oh…
03:57
<jmdyck>
replacer is called with only 2 arguments: « O, replaceValue »
03:57
<sideshowbarker>
aha
03:57
<sideshowbarker>
then I wonder why it doesn’t throw when called when called with 3 arguments…
03:58
<jmdyck>
extra args are always allowed and ignored.
03:59
<jmdyck>
no wait, you mean "why doesn't it throw when the actual replacer takes 3 args", right?
03:59
<sideshowbarker>
yeah
03:59
<sideshowbarker>
that
03:59
<jmdyck>
in that case, the 3rd arg should always be undefined
03:59
<sideshowbarker>
also, at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_function_as_a_parameter we have it documented as taking even more than just 3 arguments
04:00
<jmdyck>
(unless the implementation is doing something special)
04:02
<jmdyck>
ah, i think misunderstanding re "replacer function"
04:03
<sideshowbarker>

yeah looking at the spec, I see

  1. If functionalReplace is true, then
    a. Let replacement be ? ToString(? Call(replaceValue, undefined, « searchString, 𝔽(position), string »)).
04:04
<jmdyck>
_replacer_ is the alias that the spec uses for the @@replace method extracted from the first arg to S.p.replace()
04:05
<jmdyck>
but you're talking about the second arg
04:08
<jmdyck>
If the second arg is a function, it's called with args « searchString, 𝔽(position), string », which is roughly (needle, offset, haystack)
04:13
<jmdyck>
The MDN page's description of the second parameter looks non-standard to me.
04:14
<jmdyck>
(Though maybe all engines support it?)
04:22
<sideshowbarker>
If the second arg is a function, it's called with args « searchString, 𝔽(position), string », which is roughly (needle, offset, haystack)
OK, will go with that
04:23
<sideshowbarker>
The MDN page's description of the second parameter looks non-standard to me.
yeah, now I’m wondering where it came from to begin with
04:57
<sideshowbarker>
which part of the spec defines operator precedence?
04:57
<sideshowbarker>
looking for a reference to cite in https://github.com/mdn/content/issues/11926
04:58
<jmdyck>
Operator precedence is implicit in the grammar.
05:00
<sideshowbarker>
OK, but the statement “Precedence of 'Postfix Increment/Decrement' is higher than 'Function Call'” is not correct, right?
05:07
<jmdyck>
right (given reasonable definitions)
05:14
<jmdyck>
It's unclear why the submitter thinks that the observed behavior implies "Precedence of 'Postfix Increment/Decrement' is higher than 'Function Call'"
05:20
<jmdyck>
for a postfix op to have a higher precedence than operator OP, you expect X OP Y ++ to mean X OP (Y++) rather than (X OP Y)++, but the first option doesn't really make sense when OP is function-call.
11:54
<Ashley Claymore>
looking for a reference to cite in https://github.com/mdn/content/issues/11926
I think the confusion originated in this discussion: https://es.discourse.group/t/map-weakmap-etc-prototype-getref-key/884/8
12:01
<Ashley Claymore>
(f())++ would be a ReferenceError, but ((0, f())++ is a SyntaxError