selftest: remove prototypes from some subroutine templates
authorJamie McClymont <jamiemcclymont@catalyst.net.nz>
Thu, 8 Feb 2018 03:51:23 +0000 (16:51 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 21 Feb 2018 01:47:15 +0000 (02:47 +0100)
commit41085ad37de56504467a0014b70f6a708dcde91b
treea3215f5a4cb963d49e696a97086d4766dac83bed
parent6f9c6d369f4aa4a5c861f51041dd663e81e2ec4e
selftest: remove prototypes from some subroutine templates

Rationale, as sent to samba-technical:

  > Why do you remove the explicit argument declarations for so many functions?
  > These declarations help catch usage errors, i.e. wrong number of calling
  > arguments, especially when you add arguments to functions.

  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

Signed-off-by: Jamie McClymont <jamiemcclymont@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/selftest.pl
selftest/target/Samba3.pm
selftest/target/Samba4.pm