[pulseaudio-discuss] [PATCH] vala: Add bindings for libpulse-simple

Alexander Kurtz kurtz.alex at googlemail.com
Mon Jul 9 02:31:33 PDT 2012


Hi,

On Fri, 2012-07-06 at 17:54 +0300, Tanu Kaskinen wrote:
> does the vala compiler really do this kind of deduction?

No, it doesn't:

	$ cat Demo.vala 
	int foo(int a, string b = "", int c){
	}

	void main(){
		foo(1, 2);
	}
	$ valac Demo.vala 
	Demo.vala:5.9-5.9: error: Argument 2: Cannot convert from `int' to `string'
		foo(1, 2);
		       ^
	Compilation failed: 1 error(s), 0 warning(s)
	$ 

However, the vala compiler actually does support reordering arguments,
so it would theoretically be possible to group the default arguments at
the end without changing the C-API or any runtime wrappers. I can
rewrite the bindings to do that, but I'd actually prefer to keep them
the way the are because

      * I want to stay as close as possible to the C-API to ease
        migration, avoid confusion and to make sure that the regular
        doxygen documentation can be used.
      * I want to include as much information as possible from the
        doxygen documentation in the vala bindings. Vala allows me to
        explicitly tell the programmer where passing NULL is ok (via
        the ?-suffix). Similarly I wanted to include the information
        where passing NULL is actually the thing you probably want to
        do™ (according to the doxygen documentation).

Best regards

Alexander Kurtz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20120709/1b333706/attachment-0001.pgp>


More information about the pulseaudio-discuss mailing list