Simply put, because Node.js is huge and does a _lot_ more than just running
Javascript. d8 is very much just a simple internal debugging tool, and we
want it to stay that way -- otherwise it'll be hard to tell if the issue
we're seeing is in "d8 Node" or in V8, and it'll be harder to add support
for new language features (since hacking them into d8 is way easier than
properly wiring them up in Node). It's definitely the case, for example,
that we find it easier to add new features to d8 than to Chromium, even
though both are "official" embedders! We do support Node.js as a
first-class client though, we help when they have V8 issues and we run a
Node.js build as part of our "commit queue" so that every V8 commit is also
tested against Node.js.

Besides, there's value in Node.js being separate from V8. For example,
there's a fork of Node that uses ChakraCore
<https://github.com/nodejs/node-chakracore> (from IE) as the JavaScript
engine instead of V8, and there's similar projects using JSC (from Safari)
and SpiderMonkey (from Firefox); this sort of thing would be harder if Node
was part of V8. Also, people associated with Node this way don't have to be
associated with Google, and can represent Node's interests better in, for
example, TC39 when discussing the JS language.

Overall, TL;DR, it's good to have big projects be separate, and keep small
test runners small.

- Leszek

On Fri, Nov 13, 2020 at 9:55 AM anlex N <[email protected]> wrote:

> why not let d8 replace nodejs? d8 is official and can add nodejs strength,
> such like npm. by the way, there is deno <https://deno.land/> in js world
> that also use v8. oh my god, so many  embedders. i hope google can have
> official embedders such like d8/nodejs/deno.
> On Friday, November 13, 2020 at 4:34:04 PM UTC+8 [email protected]
> wrote:
>
>> Hi,
>>
>> You can think of V8 as a library used for compiling and running
>> Javascript. Chrome/Chromium, d8 and Node.js are all "embedders" of V8, i.e.
>> applications that use this library. d8 is a very simple, minimal wrapper
>> around the library that we use primarily for debugging, testing, and as a
>> "demo" of how to use the V8 API. Node.js is a larger application that adds
>> a whole bunch of stuff on top of V8, for example 'requires' for module
>> loading, file access APIs, all the server stuff, etc etc. You can think of
>> the difference as "d8 runs Javascript code" and "Node.js runs programs
>> written for Node, using Javascript as the language". If you just want to
>> run an algorithm written in Javascript, d8 is fine, but if you want to run
>> something that uses npm packages, you need Node.
>>
>> Hope that helps,
>> Leszek
>>
>> On Fri, Nov 13, 2020 at 9:25 AM anlex N <[email protected]> wrote:
>>
>>> i am fresh student that learning v8 and nodejs source code, today i am
>>> learning v8 docs step by step, i know v8 have built in d8 *that can
>>> directly run javascript file*, but i don't know *why we still need
>>> nodejs run javascript file.*
>>>
>>> --
>>> --
>>> v8-dev mailing list
>>> [email protected]
>>> http://groups.google.com/group/v8-dev
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/v8-dev/62dcd603-069a-46bc-98d3-615aa9b16596n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/v8-dev/62dcd603-069a-46bc-98d3-615aa9b16596n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-dev/cc4b992c-48b2-43fa-8e24-e29bc59de17dn%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-dev/cc4b992c-48b2-43fa-8e24-e29bc59de17dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAGRskv-AXMYVp_L1iBOKfeMLJ8AMmaWOLxqWi3Os_b8_bpx2mw%40mail.gmail.com.

Reply via email to