Subject:
[ruby-ffi] easier syntax
From:
rogerdpack
Date:
12/11/09 5:17 PM
To:
ruby-ffi

Perhaps it would be possible to allow for named paramters to an ffi
call, like

attach_function 'puts', :parameters => [ :string ], :returns => :int

or

attach_function 'puts', :parameters => [ :string ], :takes => :int

or

attach_function 'puts', :parameters => [ :string ], :returns
=> :int, :name => 'puts_c' # use this ruby name

or

attach_function 'puts', [:string, :string] => :int # two string
parameters return an int

That would make it possible to write the examples a lot more readable.

An example lib that does the named parameters on the fly is
http://github.com/maca/arguments

Thoughts?
-r