shurizzle / ruby-lzma-ffi

liblzma bindings for ruby
http://github.com/shurizzle/ruby-lzma-ffi
2 stars 0 forks source link

Rename to ffi-lzma and FFI::LZMA #1

Open postmodern opened 12 years ago

postmodern commented 12 years ago

Following the convention of most FFI libraries, lzma-ffi should be renamed to ffi-lzma with the namespace FFI::LZMA.

shurizzle commented 12 years ago

I'm ok with renaming lzma-ffi to ffi-lzma, but how is lzma related to ffi?

postmodern commented 12 years ago

Hey thanks for doing that so quickly. I guess the ffi- naming convention popped up when people were writing FFI bindings for libraries that already had C Extensions. So they wrapped everything in the FFI:: namespace to avoid collisions.

shurizzle commented 12 years ago

I think ::FFI namespace would be used to put in only things which are related to FFI, not based on FFI. If you want to use my ffi-lzma in an other class/module you can do something like:

module NotTheRightNamespace
  require 'lzma'
end

by this way you have NOT my lzma in global scope :)

postmodern commented 12 years ago

I don't think require respects module, it will just load the files. Probably a better compromise is to have two separate LZMA classes and a main LZMA constant:

LZMA = if RUBY_PLATFORM =~ /java/
               Java::LZMA
             else
               FFI::LZMA
             end