Another point to consider is that libuv is itself written in C.
Cognitively-speaking, the more similar we can make the two in terms of
concept and feel, the better.


On Wed, Jul 10, 2013 at 11:15 AM, Stephen Belanger <[email protected]>wrote:

> C++ also becomes pretty awkward when trying to interact with the API of a
> VM that expects to do things in a very specific way. You can't really use
> the inheritance mechanics on V8 types without making things even more
> awkward, so the class-based advantage of C++ deteriorates rather quickly. I
> feel like the design of the C API is much more explicit and descriptive of
> what it is doing at each step.
>
> On Wednesday, 10 July, 2013 at 10:53 AM, Tim Caswell wrote:
>
>
>
>
> On Tue, Jul 9, 2013 at 7:30 PM, Marcel Laverdet <[email protected]>wrote:
>
> But if you're unfamiliar with C/C++ then "myType *pointer =
> js_get_pointer(C, myObject);" is no more familiar than "Local<Value>
> my_value = arguments[2]->This();" or whatever. You don't necessarily have
> to understand what's happening with the <>'s and ->'s to get utility from
> them.
>
>
> It's not that a C or C++ is impossible to learn, it's that a C is a *much*
> simpler language to learn.  There is one and only one pointer type, there
> are no templates, no references, no magic destructors, no classes, no
> virtual functions, etc.  It's all very direct and plain.
>
> If you're going to write a binary addon for node and haven't yet learned C
> or C++, it's going to be a much shorter learning curve to learn just C than
> learn C++.
>
> Yes these features in C++ are there for a reason and can make for prettier
> APIs *once* you're comfortable with C++.  My argument is that many people
> aren't comfortable with C++.  I know a little and have written a node addon
> or two using V8's API, but I'm not comfortable with the language.  With
> luvit, on the other hand, I only have to use C to write bindings and I'm
> much more productive and happy, even though the APIs are sometimes more
> verbose.
>
>
>
>
> Specifically C++ brings the possibility of much better memory management.
> If you do "Local<Value> my_thing" C++ can determine automatically when
> you're done with it and throw it away. With C you have to specifically say
> you're done, and if you don't say you're done then there's a silent leak.
> Basically I feel that in C it's much easier to do something very wrong and
> not know it. In C++ many times if you do something wrong it just won't
> compile, which is more frustrating right now but way less frustrating when
> your code hits production.
>
>
> Don't forget that the shim layer between bindings and V8 can handle this
> for you.  Nowhere in my API do you have to manually say you're done with a
> javascript object.  There are hooks the other direction so that the engine
> can tell you when it's done with an object in case you've embedded some
> memory you manage in it, but that's simple logic.
>
> My goal is to expose a very JS-like semantic to bindings authors since
> they are interfacing with JS.
>
> -Tim Caswell
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to