[Libguestfs] [PATCH] v2v: Use unitless methods for methods which don't change the internal state.

Pino Toscano ptoscano at redhat.com
Fri Aug 26 13:25:54 UTC 2016


On Friday, 26 August 2016 14:08:37 CEST Richard W.M. Jones wrote:
> Methods in OCaml which don't take any parameters don't require the
> dummy unit arg, ie writing:
> 
>   method foo = ...
> 
> is fine.  The reason you might need the unit arg is if you need to
> create a closure from the method without calling it, for example if
> you need to use the method in a callback.
> 
> In lablgtk2 the convention is to use unitless methods if either: the
> method shouldn't be used as a callback; or: (conceptually) the method
> doesn't change the object's internal state.  Let's do that here.
> ---

Ah OK, it makes sense.  I chose the safe way and added the unit arg
to avoid issues with closures, although I'm fine with the change given
that it follows an established convention.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160826/7246f8d5/attachment.sig>


More information about the Libguestfs mailing list