On Sat, Sep 21, 2013 at 4:29 PM, brian m. carlson <sand...@crustytoothpaste.net> wrote: > On Sat, Sep 21, 2013 at 01:48:08PM -0500, Felipe Contreras wrote: >> Hi, >> >> It was discussed before that there was a need to replace Git scripts >> from perl and sh that utilize the 'git' binary to do everything they >> need, which requires many forks, and that creates problems on >> platforms like Windows. >> >> This is a first step meant to show how a solution using Ruby would look like. >> >> Other alternatives just don't cut it. Shell scripts are too simple, and >> invariably require forks. Perl could use Git's internal C code, but it's >> syntax >> is too cumbersome and it's loosing more and more popularity. Python and Ruby >> are the only modern languages that could fit all the needs, but Python's >> syntax >> is not ideal, specially considering the background of the Git community, and >> also, Ruby's C extensibility is simply superb. >> >> This patch series introduces Ruby bindings for Git's C internal library, and >> add example commands to show how it could be used, and how it resembles the >> original C code, shell code, and perl code. Basically, Ruby fits like a >> glove. > > A couple of things: first, I'm not opposed in principle to using Ruby > for git. As you say, it's a good language and it has much nicer C > bindings. > > As Junio has also pointed out in the past, there are people who aren't > able to use Ruby in the same way that they are Perl and Python. If it's > announced now, Git 2.0 might be a good time to start accepting Ruby > scripts, as that will give people time to plan for its inclusion.
Yes, and there are people who aren't able to use Perl/Python in the same way they use Ruby. That's why I tried to show why Ruby makes a perfect choice. > On a more technical note, my objection to your binding implementation is > that fundamentally, Ruby is an object-oriented language, but your > bindings don't take advantage of that; they're completely procedural. I > realize most of the git codebase is as well, but that's because it's > written in C. It seems a shame not to take advantage of what the > language offers, especially since I know others are going to want to > take advantage of the provided bindings. For the moment the bindings are only for Git commands, so the primary users are Git developers, that's why I tried to leave them close to the current C/shell/perl code. Having said that, it does use a little bit of object-oriented stuff: commit = lookup_commit_reference(sha1) p commit.buffer Now, if anybody has ideas into how the bindings could be more object oriented, I'm all ears, but unfortunately what I foresee is that nobody will consider this proposal seriously. Cheers. -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html