Live data from Hacker News

A git implementation in pure JavaScript

github.com

21–30 of 38 posts

Re: A git implementation in pure JavaScript

#21
post #18
post #6

Earlier quoted context omitted.

I've never understood why this question is asked on Hacker News. Can you really not imagine why someone would try to do this, even as just an intellectual exercise?

Perhaps he has sufficient imagination to come up with two or three possible reasons why someone might do this, and hence is asking so as to find out which is the actual reason. By asking, he might learn something, especially if the reason turns out to be one he had not thought of.

You're probably just playing the devil's advocate, but it's plainly obvious that the guy was just being rude. If he was actually interested in an "I can see so many reasons you'd make this" kind of way he wouldn't have been so curt.

Re: A git implementation in pure JavaScript

#22
post #19

The node.js JavaScript surge reminds me a bit of the early days of Java, where everyone went to implement whatever existed in C/C++ for Java. Only that this time people stick a ".js" in the end instead of a "J" in the front. If history has a lesson, most of this will not be wildly successful, because the js environment is not suitable for the task to be an actual practical solution.

Such efforts may not 'succeed' on the whole.

However there is great benefit to this young language when a popular utility can be implemented to highlight the weakness of a particular runtime implementation, or even the underlying language.

Git/Hg clients touch network io, file io, and rudimentary hashing in the normal execution path. So it makes for a good subject.

Re: A git implementation in pure JavaScript

#23
post #19

The node.js JavaScript surge reminds me a bit of the early days of Java, where everyone went to implement whatever existed in C/C++ for Java. Only that this time people stick a ".js" in the end instead of a "J" in the front. If history has a lesson, most of this will not be wildly successful, because the js environment is not suitable for the task to be an actual practical solution.

Surely if that bit of history says anything then this will be successful? There is a big incentive for languages to reimplement natively, for Java it was cross platform consistency and security, for js in the browser it is complete unavailability of a native code API. (for node.js I am not really convinced though). Sure there are some issues with js, eg binary support in browser is painful, and it is slow, but Java s…

Surely if that bit of history says anything then this will be successful?

Not sure. Lots of people reimplemented lots of stuff for Java, but it turns out Java was only successful in the sweet spot for it (networked server side language); it never replaced C/C++ in any meaningful way.

I expect the same with JavaScript, it will flourish in its niche (in particular as it has a monopoly as the in-browser-language), but it won't replace established languages on their respective home turf.

Re: A git implementation in pure JavaScript

#25
post #23

Earlier quoted context omitted.

Surely if that bit of history says anything then this will be successful? There is a big incentive for languages to reimplement natively, for Java it was cross platform consistency and security, for js in the browser it is complete unavailability of a native code API. (for node.js I am not really convinced though). Sure there are some issues with js, eg binary support in browser is painful, and it is slow, but Java s…

Surely if that bit of history says anything then this will be successful? Not sure. Lots of people reimplemented lots of stuff for Java, but it turns out Java was only successful in the sweet spot for it (networked server side language); it never replaced C/C++ in any meaningful way. I expect the same with JavaScript, it will flourish in its niche (in particular as it has a monopoly as the in-browser-language), but i…

It did replace C/C++ in a meaningful way. I think there's probably more Java jobs out their than C/C++. Though C/C++ is still much better than Java in a lot of areas, no doubt. You can't write a good looking app, or get write a kernel.

Maybe "replace" is a bad word though. Java complimented C/C++, creating a whole new market.

Re: A git implementation in pure JavaScript

#26
post #25
post #23

Earlier quoted context omitted.

Surely if that bit of history says anything then this will be successful? Not sure. Lots of people reimplemented lots of stuff for Java, but it turns out Java was only successful in the sweet spot for it (networked server side language); it never replaced C/C++ in any meaningful way. I expect the same with JavaScript, it will flourish in its niche (in particular as it has a monopoly as the in-browser-language), but i…

It did replace C/C++ in a meaningful way. I think there's probably more Java jobs out their than C/C++. Though C/C++ is still much better than Java in a lot of areas, no doubt. You can't write a good looking app, or get write a kernel. Maybe "replace" is a bad word though. Java complimented C/C++, creating a whole new market.

That's what I mean, Java didn't replace C++, it found its own market. Thus there is little point in porting everything (for appropriate values of everything) to Java (or JavaScript); you aren't gonna need it there.

Re: A git implementation in pure JavaScript

#27
post #26
post #25

Earlier quoted context omitted.

It did replace C/C++ in a meaningful way. I think there's probably more Java jobs out their than C/C++. Though C/C++ is still much better than Java in a lot of areas, no doubt. You can't write a good looking app, or get write a kernel. Maybe "replace" is a bad word though. Java complimented C/C++, creating a whole new market.

That's what I mean, Java didn't replace C++, it found its own market. Thus there is little point in porting everything (for appropriate values of everything) to Java (or JavaScript); you aren't gonna need it there.

Pretty much everything has been ported to Java. Almost no one programming in Java uses native libraries at all. I cant think of libraries that were not ported; the Java ecosystem is now very self comtained relying on innovation within its own community.

Essentially Java replaced C++ in most of the enterprise programming market.

Re: A git implementation in pure JavaScript

#29
post #9

I thought about doing an in-browser git implementation for enabling offline mode in a webapp. Doing things with git would make some really interesting sync scenarios possible. Looking at what was involved though, I think I'm glad I didn't go down this particular rabbit-hole.

Another cool tool in this world is CouchDB. A local instance can replicate back and forth with a master when available, and you can serve an entire app right out of the DB.

Re: A git implementation in pure JavaScript

#30
post #14
post #6

Earlier quoted context omitted.

I've never understood why this question is asked on Hacker News. Can you really not imagine why someone would try to do this, even as just an intellectual exercise?

Depends if porting code from one procedural language to another is an "intellectual exercise" (it usually isn't). Compare with the x86 emulator written in JS that we saw a few months back. That said, viewing a git repo in a web browser by querying the repo over HTTP directly is pretty damn cool.

It's an intellectual exercise if you want to learn how git works. One of the best ways to learn something is to attempt porting it.
Post reply on HN