[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another take on hackers and painters



Paul Prescod <paul@prescod.net> writes:

> I think that the real problem reported by (ex-) Perl users is that
> Perl sometimes sees string values that do not have reasonable integer
> representations and rather than telling you that it just guesses that
> you meant for the value to be 0. Often that will mask error conditions

What horrible rumors! :-) At the risk of setting myself up as an
apologist for Perl, how pedantic/helpful a programmer would like the
language to be is configurable.  Perl will only ever try to interpret
a string as a number if it is provided with a string where it expects
a number.  Further if you're running with "use warnings" (which is the
recommended option with which to run perl programs) then perl *will*
complain if it tries to autoconvert not-a-number into a number.

What may be a question of taste and thus open to debate is whether or
not the use-warnings option ought to be the default.  If a programmer
refuses to turn on warnings, they accept the responsibility for
letting perl guess for them.  I think more generally the design
decision in question here is whether a language designer wants to take
the responsibility for preventing a careless coder from shooting
himself in the foot even if it means making it hard for a programmer
that knows what he/she is doing from "just getting on with it".  Perl
seems to leave a bunch of these decisions as run time options.

-- 
Jasvir Nagra
http://www.cs.auckland.ac.nz/~jas