Subject: Re: [ruby-ffi] easier syntax |
From: Michael Fellinger |
Date: 12/12/09 2:23 AM |
To: ruby-ffi@googlegroups.com |
On Sat, Dec 12, 2009 at 8:20 AM, Evan Phoenix <evan@fallingsnow.net> wrote:
I don't see any benefit of this over the existing syntax. I must advise against changing things like this at this stage in the game. The FFI implementations are already a bit diverged, and adding something like this would only serve to completely destabilize any cross impl. using of FFI.
Not to mention that one can simply implement a different method that takes arguments like this in a few lines.
- Evan On Dec 11, 2009, at 3:17 PM, rogerdpack wrote:http://github.com/maca/arguments Thoughts? -rPerhaps 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
-- Michael Fellinger CTO, The Rubyists, LLC 972-996-5199