red-data-tools/GR.rb

add fiddladd fiddley.rb to fiddle

dsisnero opened this issue · 3 comments

this gem has a lot of tools that would be very useful for other fiddle users. Please consider adding them to ruby/fiddle

make it op-in require/fiddle/conversions ?

fiddley is the work of unak.
https://github.com/unak/fiddley

In GR.rb, I duplicated fiddley's code and modified it to use only the parts I need. (I think it is a common practice in C projects to duplicate code and add it to the repository.) The fiddle part of GR.rb is licensed under The 2-Clause BSD License. The rest of the code is MIT.
https://github.com/red-data-tools/GR.rb/blob/main/LICENSE.txt

So, I think the key point of this issue is whether to integrate unak/fiddley into the fiddle.


I like ruby-ffi, and GR.rb was initially implemented in ruby-ffi. So GR.rb uses fiddle, but the API is compatible with ruby-ffi.

Some core developers wanted to stop using ruby-ffi and use fiddle instead. However, my honest impression is that ruby-ffi has cleaner code and more consistent API, and the developers are patient and continue to maintain it. I think there is a good reason why ruby-ffi is widely used.

For example, in Fiddle, the callback is written as follows
Fiddle::Closure::BlockCaller.new(Fiddle::TYPE_INT, [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP]){|x, y|
horribly awkward to use, but probably can't be changed for backward compatibility.

Diversity is important. Fiddle seems to have value in its smallness and lack of functionality.
In general, small things are beautiful, but I think there are parts of Fiddle that are not so beautiful.
However, I feel that if we make fiddle like ruby-ffi, the good part will be lost.

I've written a lot, but there is no conclusion.

I realized that my frustration with Fiddle was not with its lack of features, but with its lack of beauty. It may have needed more refactoring in the early stages. By now, Fiddle is already too "mature"...

Reported to Upstream.
(I guess I got a little too emotional.)