proposal-standardized-debug icon indicating copy to clipboard operation
proposal-standardized-debug copied to clipboard

Future compatibility, debugger.* should be valid at syntax level.

Open Jack-Works opened this issue 5 years ago • 3 comments

For example, we add a debugger.xyz in the future, we cannot use it immediately  because in the older engine it is a syntax error.

Solution: make debugger.* (unknown name access) to be a valid call / allowing ?. operator on it.

Example:

debugger.xyz(expr) // or
debugger.xyz?.(expr)

Jack-Works avatar Nov 17 '20 10:11 Jack-Works

That would still not allow it to be used immediately, since older engines that is also a syntax error.

As with any new syntax, the solution for older engines is "transpiling".

ljharb avatar Nov 17 '20 10:11 ljharb

What I mean "old" is, new enough to support debugger.log but not any other future methods.

Jack-Works avatar Nov 17 '20 10:11 Jack-Works

Ah, gotcha. If it's syntax, I'd expect that to require transpiling as well; if it behaves like a function on an object, i'd expect debugger to be an object too.

ljharb avatar Nov 17 '20 10:11 ljharb