Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Diving into C++ internals of Node (indutny.com)
143 points by anandsuresh on May 16, 2015 | hide | past | favorite | 31 comments


Thanks for writing it up! Diving into a large production-level C++ library is always going to be intimidating. I suppose projects like Node/io.js need as many contributors as they can get, so anything that lowers the barriers to entry for new contributors is a good thing.

With regards to the language mentioned below: the English is very good, albeit a bit terse. I think the main issue is that the article tries to cover a lot of ground in such a short time. My advice for @indutny is to narrow the focus a bit and pick a clear structure for the article, with an introduction and a conclusion.


Thank you for the kind words.

It is quite terse indeed, mostly because it was written as a basis for my 30 minutes talk on JSConf Budapest. I guess, I'm going to eventually cover this topic in a greater detail.

Thank you for advice!


I emailed Fedor awhile back about some tips on diving into C++ and he was nothing but an amazing help on resources and places to start looking. This article is great and written buy an awesome person. Thanks Fedor!


I've been looking for something like this for a while. I find it extremely hard to understand an open source project just by looking in the code. Where to start? what are the flows? ...etc.

Nice post, as an ESL, your English didn't bother me at all, it seemed normal to me. Maybe push a bit deeper on the technicalities.


I'm perpetually amazed by the breadth of your knowledge, Fedor. It's unique that your attention spans traditional compiled code all the way to Node, and even includes Bitcoin. What is it that drew you to the latter two?


Curiosity? :)


Can you use just C for writing node.js addons?


If you want to go a little overboard it's possible to use the C abi and write a thin wrapper in C++.


Unfortunately not. Node is bound tightly to V8, which is very C++.

You can, though, use things like node-ffi.


Doesn't that make the answer "mostly yes, but you need to write the binding in C++"? I.e. write all your code in C, then just call the C methods from the one C++ class you must write.


You can write the library/addon in C and then define the bindings with JavaScript using various npm libraries. There's no need for C++.

Here's an example of such a wrapper over a C library: https://github.com/panuhorsmalahti/mtp


Eh, by that logic, we can write Node extensions in Fortran or Brainfuck.


I think it might be possible to do it with some sort of wrapping library written in C++ with C APIs. Technically, it will work this way for every kind of C++ library.


I tried to read the article from the beginning. Had to stop since the language was incomprehensible.


I'm terribly sorry for this. English is not my native language.

If you have any particular suggestions - would you mind posting them as a comment to this commit: https://github.com/indutny/blog/commit/8409a9d98c44a24359b53... ?

Thanks for giving a try ;)


Nothing to be sorry. I learned a lot! Thanks a lot for the article. And also, we are production users of Bud - thanks for that too :)


Oh, this is super cool! Thank you.


To be honest, your English looks absolutely fine to me, which is why I downvoted that comment for trolling. The content was also excellent; not often you get that sort of look at the internals of a project.


I'm not the parent commenter, but I added some comments to the commit for you. Thanks for the article!


Whoa, thank you! Fixed almost every of them. Hope it is better now.


I found your text quite comprehensible although I'm not a native English speaker.



I find his accent heavy but tolerable --- but I wanted to clarify, could you (or someone) give an example of a place where it was incomprehensible? (perhaps the place where you had to stop).

I'm not asking this in order to try to imply that it is perfect american english, but in order to better understand myself (maybe others perhaps) what could be improved.

Thanks!


I find his accent heavy but tolerable

Honest question, where did you found his accent in the text ?


Accent is not just the actual tones and sound of actual speech but also the sentence construction, word selection and style that influence the voice heard in a reader's mind.

As an example looking at your second sentence.

"Honest question, where did you FIND his accent in the text". It might have been better phrased as "where did you hear/read/see/detect the accent in his text?" Find isn't quite the right choice to my eye.

This was a minor error that could have been a simple typo but is also a typical error of a non-native english speaker. If you made mistakes like this repeatedly over a longer post it would influence the voice we heard as we read your post.

This is not a huge issue or something you should worry about beyond just noticing and self improving over time.

(I would not have particularly noticed or disapproved of your sentence if you hadn't asked.)

The blog post was missing several words in the first few paragraphs and had some awkward constructions. It was largely ok reading for a technical post but there was definitely an "accent" that emerged from reading it.


AlexeyBrin's 'second sentence' was really their first. The previous sentence was a quote from the person they were responding to. That person said "I find his accent heavy but tolerable"

AlexeyBrin was specifically referring to the parent's choice of stating they found an accent in a text (which is why they italicized 'his accent', which you neglected to quote). AlexeyBrin was also using the root word 'find' (albeit in an improper conjugation) to parallel the same use of that word that they were responding to.

I agree with your point about accent carrying over into text, but I think you misunderstood some of the intent of the person you were responding to.


If you're reading text written by an individual, it is certainly possible for the text to be written with an accent and/or interpreted with one. Maybe the mind tends to do this more when it knows the person or where they are from -- I do not know.

As a native English speaker who has spent a number of years learning Russian, I can only offer my interpretation of what parent meant. Most of the "accent" might be coming from the incorrect use of articles. The Russian language does not use articles like English does, and my teacher (among others) say this is the hardest part of English for native Russian speakers to learn because it is so foreign (much like an English speaker learning to decline every word in a Russian sentence). I live in NYC and spent a lot of time around English speaking Russians and once you hear what I'm referring to, you can't un-hear it.


You have the correct interpretation of the English word "accent." An accent pertains to spoken language (e.g., pronunciation and prosody). It is only in a loose or figurative manner of speaking that you could talk about the accent of a text.


I meant in a figurative manner? I don't understand the difference between figurative and the alternative probably, lol.

Is the better a word to accent to use for the accent present in the written word?

Aye there chappy this is ye' ole english eh?


After re-reading the article, I guess an incorrect use of language wasn't the problem per se, but perhaps the confusing structure and lack of motivation. It's not clear why the author wants to express certain things.

For example, how do the examples ("Declare all... avoid polymorphism...") relate to the rest of the article? They seem quite detached.

I can sense the author has some ideas but they don't reflect in the words of the article.


You can use Google Translate to convert the page into your language.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: