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

RE: another take on hackers and painters

Dan Sugalski wrote:
> The big reason for this is the origins of perl--it started as a
> language for quick-n-dirty sysadmin and text processing tasks and
> grew out from there. Many of the programs lived only on the command
> line, and many more were thrown together in a dozen or two lines of
> code. The data they dealt with was dirty, but dirty in predictable
> ways, and perl's defaults are shaped to deal with that.

Right - but the problem, and the only reason anyone outside the Perl
community needs to care about it, is that these behaviors are now being
spread and even promoted as a proper way to do things in other contexts.
Perl is teaching people bad habits, and missing an opportunity to teach
better ones.

> >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.
> Right, and those warnings can be set to be errors as well if you want.

If autoconversion is desirable in some contexts, then surely what you want
is the ability to mix autoconversion and strictness in the same program?
Which probably means that different operators (or functions) are needed for
the different purposes.  Proposal: add an operator ~+~, pronounced
sloppy-plus.  :-)