[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r17771 - branches/bdb-fixes/tools/dev

From: John Peacock <jpeacock_at_rowman.com>
Date: 2005-12-23 03:11:53 CET

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.

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Dec 25 03:02:05 2005

This is an archived mail posted to the Subversion Dev mailing list.