[OT] Perl woes

Ovid publiustemp-londonpm at yahoo.com
Wed Jan 28 13:01:55 GMT 2009

----- Original Message ----

> From: Jonathan Kimmitt <Jonathan.Kimmitt at csr.com>

> Most people on this list seem to defend the perl design decision such
> that
> if ($item == "xyzzy")
> should only emit a warning, because after all, a string can be converted
> to a number with no loss of meaning (!).
> However, what about this one:
> for (my $i==0; $i<($tbl_width - 1); $i++) { .... }
> Is anybody seriously arguing this could possibly do anything useful.

You could try to file a bug report, but I don't know if it would be accepted.  This, I think, is a side-effect of dynamic typing.  Because you can't know at compile-time what your expressions evaluate to (it's more than just "what your 'type' are"), you can't possibly catch all cases where it's "unsafe" to use a particular construct.  And I don't know if you were concerned with the "$i == 0" or the "$tbl_width -1".

It's a trade-off between the obvious ease of use of dynamic typing and sometimes being bitten by the inability to statically evaluate expressions.

Note that I understand your frustration.  It gets to me sometimes, too :)

Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

More information about the london.pm mailing list