question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use Compartment.p.evaluate instead of eight magic lines

See original GitHub issue

Currently, even on xsnap, we’re building SES essentially the same way we do on normal JS, by running the full SES shim including the eight magic lines built on direct eval. Currently, XS eval does not understand the sourceURL directive, so all SES code runs in XS without any tie to a filename. Also, using the eight magic lines, we cannot fix #31

Instead, we could switch to using the XS builtin Compartment.prototype.evaluate as our safe evaluator, replacing the eight magic lines, while still building the rest of SES using code from the SES shim. This should immediately fix #31 .

In addition, perhaps it is easier to get XS to accept a filename via Compartment.prototype.evaluate rather than the sourceURL directive in an eval? Attn @phoddie

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
kriskowalcommented, May 18, 2021

We’ll need a follow-up change in SES to feature-detect the suitable XS Compartment and switch the behavior of performEval to use that instead of the “three wrongs of with + sloppy + eval that make a right”.

1reaction
erightscommented, Jun 25, 2021

For the “sloppy globals” issue, we could painlessly add a dirt simple translator to our repl, replacing a first line matching

/^(\s*)(\w*\s*=)/

with

`${m[1]}globalThis.${m[2])`
Read more comments on GitHub >

github_iconTop Results From Across the Web

Annotated List of Command-line Options - ImageMagick
Below is list of command-line options recognized by the ImageMagick ... To instead print to your device, use -define auto-threshold:verbose=true .
Read more >
Evaluation Matters: Getting the Information You Need from ...
you do and the strategies you use but rather a way to weave evaluation into the design, development, and implementation of your programs...
Read more >
TikZ and pgf
The pgf package, where “pgf” is supposed to mean “portable graphics format” (or “pretty, good, functional” if you prefer...), is a package for...
Read more >
Math208 Discrete Mathematics - College of Arts & Sciences
table for (p ∧ q) → r, first notice that eight rows will be needed in the table ... Instead of using a...
Read more >
The Book Thief - SharpSchool
I am in all truthfulness attempting to be cheerful about this whole topic, though most people find themselves hindered in believing me, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found