Subject:
Re: [ruby-ffi] easier syntax
From:
Evan Phoenix
Date:
12/11/09 5:20 PM
To:
ruby-ffi@googlegroups.com

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.

 - Evan


On Dec 11, 2009, at 3:17 PM, rogerdpack wrote:

> 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
>