Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Supporting Template Literals in Parser #86

Open
K1NZ54 opened this issue Sep 30, 2023 · 0 comments
Open

Enhancement: Supporting Template Literals in Parser #86

K1NZ54 opened this issue Sep 30, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@K1NZ54
Copy link

K1NZ54 commented Sep 30, 2023

Hello,

Following the recent suggestion by @prevwong regarding supporting template literals for parsing JavaScript:


Reka.create({
  externals: {
    functions: (self) => {
       return [
         t.externalFunc({ name: "js", func: (args) => {
              const fn = new Function(`return ${args.expr}`);
              return fn();
         }})
       ]
    }
  }
});
val str = "hello world";
$js(`console.log(${str})`);

While this approach seems promising and can potentially streamline some operations, I have concerns regarding how we can update internal variables using this mechanism. Specifically, executing return statements is straightforward, but what's the proposed method for internal value updates? I'd appreciate any insights or suggested best practices on this.

Thank you for considering this enhancement and looking forward to the team's feedback.

@prevwong prevwong added the enhancement New feature or request label Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants