Open JesseBuesking opened 7 years ago
Looks great! 👍 I wonder why C? for some users that might seem unpreferable. Does it support Windows? Also is there support to be easily possible to add other languages than English?
Thank you!
I wonder why C? for some users that might seem unpreferable.
I wrote a bit about the project on my blog, where I explain why I chose C:
One benefit of my approach is that I separated the underlying C logic into an entirely separate library. This means that we can include it not only within our Ruby gem, but it also means that we could write, say, a Python wrapper around it making the logic available within Python’s ecosystem as well.
One other reason that I failed to mention on the blog post is that by using C we can manage memory ourselves, relieving GC pressure in rubyland.
Does it support Windows?
I have a coworker who develops on Windows, and I have yet to hear any issues. I'll chat with him today and let you know if there are any problems running on Windows.
Also is there support to be easily possible to add other languages than English?
Currently it only supports English, but there's nothing preventing us from adding other languages. I'm not sure what the cleanest way to support other languages would be that would make the process "easy", so suggestions are welcome.
Sounds good! :) I noticed that codebase seems to be quite large like I don't really see why need so much code for it but okay.
I agree, there's a decent bit of code broken out across quite a few files 😄
For one thing, C is much more verbose than ruby and requires more lines of code overall. My implementation uses a lexer and parser to find and replace the numbers, so there's additional overhead for those things as well.
Most of the additional C logic is spread across:
The core of OmNomNum is really only spread between 3 files: omnomnum.c
, parser.yy
, and scanner.re
. I intend on writing a blog post that's more of a technical deepdive which might help to demystify the codebase and make it less intimidating.
Does it support Windows?
I spoke with my coworker today and he says it runs without any problems. One thing to note is that he uses Bash on Ubuntu on Windows which probably makes compilation of extensions less difficult.
FYI, using Windows Subsystem for Linux is pretty much same as using Linux VM or whatever with cross-compiling for Windows.
Anyway thanks for explanation and it really looks promising.
Hey all!
I just created the library OmNomNum, a C extension that I aim to use as a replacement for Numerizer. OmNomNum currently does not support fractions, so it's not a 100% replacement for Numerizer just yet.
The main purpose of adding this issue was to let you know that my library exists. Ideally other Rubyists using this library could benefit from OmNomNum. Let me know if you're interested in possibly working together to add support for OmNomNum to Numerizer.
If you have any questions, just let me know.
:+1: