[PATCH] Selftest improvements

Jamie McClymont jamiemcclymont at catalyst.net.nz
Thu Feb 8 04:01:07 UTC 2018

On 08/02/18 16:17, jim via samba-technical wrote:
> Why do you remove the explicit argument declarations for so many
> These declarations help catch usage errors, i.e. wrong number of calling
> arguments, especially when you add arguments to functions.

Hi Jim,

My understanding is that because these are object methods, the
prototypes actually were not providing the checking benefits [see
PERLSUB(1) (section "Prototypes")] -- this is evidenced by the fact that
some of the prototypes I removed actually had the wrong number of arguments!

Now that the subroutines are being dynamically called by function
references, the checking also appears not to apply [see the same source].

There was also a more concrete reason: the setup code will automatically
set up multiple environment dependencies and pass each of their vars as
an individual parameter. Accomplishing this was [seemingly] impossible
with the prototypes in place.

Additionally, there seems to be a consensus among perl devs that
prototypes are generally harmful: see this post (by my colleague) for
example: http://www.perlmonks.org/?node_id=406231

If this is okay, attached is a version of the patch with this commit
separated out and the explanation in the message.

- Jamie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samba-jamie-selftest-improvements-7th-attempt.patch
Type: text/x-patch
Size: 26919 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180208/05b43352/samba-jamie-selftest-improvements-7th-attempt.bin>

More information about the samba-technical mailing list