LivelyKernel / LivelyKernel/lively4-core

Conflicting Var-Recorder and the Live-Programming plugin

Open
#372 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

comp: transpilation effort2: medium (days) P3: important type: bug
Dominant language
JavaScript
Stars
89
Forks
25
PR merge metrics
No merged PRs in 30d

Description

#### Error

Printing the following code in a Workspace results in unexpected behavior:

```JavaScript
var array = [1,2,3]
debugger
array = []
debugger
array
```

The above code, executed in one go, evaluates to `[1, 2, 3]`. However it should evaluate to an empty array.

Executing the code line-by-line results in the expected bahavior.

#### Possible Explanation

The issue may result from the interaction of two babel plugins, the Var-Recorder and the Live-Programming plugin, inside a workspace.

```JavaScript
(function(System, SystemJS) {System.register([], function (_export, _context) {
"use strict";

return {
setters: [],
execute: function () {
var __global_this__ = window.__pluginDoitThisRefs__["efafc263-5f9e-447b-aa34-68ee3ed50caf/"];
var array = [1, 2, 3];
_recorder_.undefined.array = array;
debugger;
_recorder_.undefined.array = [];
debugger;
const __result__ = array;

_export("__result__", __result__);
}
};
});
})(System, System);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndvcmtzcGFjZWpzOmVmYWZjMjYzLTVmOWUtNDQ3Yi1hYTM0LTY4ZWUzZWQ1MGNhZi9saXZlbHkta2VybmVsLm9yZy9saXZlbHk0L2FleHByL3VubmFtZWRfbW9kdWxlXzQxNWEyZjFiXzhmYjhfNDhjZF9hNmFkXzdlYmQ5ZTgxZjhjMiJdLCJuYW1lcyI6WyJhcnJheSJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUFBLFVBQUlBLFFBQVEsQ0FBQyxDQUFELEVBQUcsQ0FBSCxFQUFLLENBQUwsQ0FBWjs7QUFDQTtBQUNBLG1DQUFRLEVBQVI7QUFDQTt5QkFDQUEsSyIsImZpbGUiOiJ1bm5hbWVkX21vZHVsZV80MTVhMmYxYl84ZmI4XzQ4Y2RfYTZhZF83ZWJkOWU4MWY4YzIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgYXJyYXkgPSBbMSwyLDNdXG5kZWJ1Z2dlclxuYXJyYXkgPSBbXVxuZGVidWdnZXJcbmFycmF5XG4iXX0=
```

Executing both plugins leads the Live-Programming plugin to not use the rewritten value, but its original un-proxied reference.

Also notice the `undefined` module name resulting from evaluating the script inside a workspace. I did not yet checked for similar behavior inside a named js-module.

#### Possible Solutions

Rewriting both aspects in one go might remove this issue.
If not, the Live-Programming plugin should be applied only after the Var-Recorder.

#### Similar Issues

#257

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the provided JavaScript snippet by executing it in a workspace, then inspect the interaction between the Var-Recorder and Live-Programming plugins. Verify that the final result is an empty array and investigate the reported undefined workspace module name; done means both behaviors are corrected without regressing line-by-line execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.