5 minimums for any perl script?

Damian Conway damian at conway.org
Mon Jan 30 00:26:32 GMT 2012


> don't use subroutine prototypes unless you've read about them and know
> what you're doing.

Damn straight.

But I'd also add: even if you *have* read about them and think you know
what you're doing...think again. ;-)

Even when used correctly, prototypes change the behaviour of client code
in mostly invisible ways...which is almost never a good idea.

Using a (&@) prototype to allow something like:

    apply_functor { functor } @data

is okay, as the new semantics are explicitly marked by the block.

But almost any other prototype components are going to make
ordinary-looking client code silently magical, so that something like:

    defenestrate_clients(@client_data)

has invisibly different semantics. That is not fine because now you
can't tell how that code behaves just by looking at it. :-(

Damian


More information about the london.pm mailing list