John Peacock wrote:
> Branko Čibej wrote:
>
>> David James wrote:
>>
>>> Why add prototypes?
>>>
>> Because "use strict" requires them.
>>
>
> No, it doesn't; where did you get the idea that it did. Prototypes in Perl are,
> as David described, not what you might expect them to be. The "$" prototype
> doesn't require that the argument be a scalar, it evaluates the argument in a
> scalar context, which is a very different thing.
>
>
>>> For example, the "$" prototype
>>> converts an array of letters ("a",b","c","d") into a count of the
>>> number of elements (e.g. "4"). Is this really what you want to do?
>>>
>>>
>> Yes. Why not?
>>
>>
>
> Because then you only know how many arguments were passed in, rather than the
> *value* of the arguments. Get a copy of Damian Conway's "Perl Best Practices"
> and see p 194 for example, where he demonstrates exactly why prototypes are best
> unused.
>
FWIW, I've changed stress.pl on trunk so that it "uses strict" but
doesn't use prototypes. The version on the bdb-fixes branch is now
defunct, and I won't be merging it to trunk when the time comes.
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jan 16 00:42:59 2006