On Fri Jun 2 13:51:50 2023 +0000, Jacek Caban wrote:
That all seems a workaround. The actual problem is that arguments object stores arguments from detached scopes in variable object, but it doesn't have to. It could just allocate an array and store them there. It may need extra care to make sure that lookup by name keeps working correctly, but it should be doable unless I'm missing something.
Yeah that's the problem, the name lookup. It would need special casing where it's done, which I think is more work than just special casing it into the arguments object itself (since it's specific to it, anyway).
BTW is it just detached scopes? Doesn't it apply also for accessing arguments' variables via name (as "local vars")? Modifying an arg syncs it with the arguments object.