[quickjs-devel] Re: Export JS_ToQuotedString()

  • From: Charlie Gordon <quickjs@xxxxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Sun, 11 Aug 2019 10:32:43 +0200

Haha! That would be the final shutdown on javascipt code in QuickJS :)

In early versions, most of the QuickJS builtin library was written in 
javascript. There were some advantages in this: the code was more compact and 
more independent on the actual implementation of the runtime internals. It was 
easier to make changes in the engine as they did not impact the library, but it 
was slower and made the runtime instantiation more costly too.

We are very interested in use cases from programmers. We have tried to design 
QuickJS for embedding in larger projects but have not used it in our own 
projects extensively yet. The C API probably needs more work as well as the 
JSCFunctionListEntry static object description and initialization system.

Thank you for your feedback

Chqrlie.

On 10 Aug 2019, at 21:17, Connor Nolan <connor24nolan@xxxxxxxx 
<mailto:connor24nolan@xxxxxxxx>> wrote:

I'm making a REPL in C, so no JavaScript, and I need to bind a function for 
later in C.

Get Outlook for Android <https://aka.ms/ghei36>
From: quickjs-devel-bounce@xxxxxxxxxxxxx 
<mailto:quickjs-devel-bounce@xxxxxxxxxxxxx
<quickjs-devel-bounce@xxxxxxxxxxxxx 
<mailto:quickjs-devel-bounce@xxxxxxxxxxxxx>> on behalf of Charlie Gordon 
<quickjs@xxxxxxxxxxx <mailto:quickjs@xxxxxxxxxxx>>
Sent: Saturday, August 10, 2019 3:16:05 PM
To: quickjs-devel@xxxxxxxxxxxxx <mailto:quickjs-devel@xxxxxxxxxxxxx
<quickjs-devel@xxxxxxxxxxxxx <mailto:quickjs-devel@xxxxxxxxxxxxx>>
Subject: [quickjs-devel] Re: Export JS_ToQuotedString()
 
On 10 Aug 2019, at 20:51, Connor Nolan <connor24nolan@xxxxxxxx 
<mailto:connor24nolan@xxxxxxxx>> wrote:
It would be nice if you could create a quoted version of a string, without 
having to rely on "__quote()", it would also be nice if js_function_bind was 
able to be called from C without having to call a JavaScript function 
"bind()".


JS_ToQuotedString seems easy to export, the API is quite straight forward.

In case you wonder, I hesitated to make the Javascript binding a method of 
String named toSource() as is available in Firefox, but not many engines 
support this only for strings would have been misleading, We even considered 
removing it, but it is used un json formatting and handy for displaying 
values in the REPL.

js_bind_function() is more cumbersome to call directly from C, but why not, 
except for the naming scheme...

What is your use case?

Chqrlie


Other related posts: