I can't imagine any way in which one can consider Perl typing to be "strong".
When you know the type of a variable, you are supposed to have confidence that
when you see a statement
a - lexically locally (without looking around elsewhere) and
b - at compile time
you know exactly what the statement means.

1 - A scalar that has been assigned a string value reacts differently than a
scalar that has been assigned a numerical value to operations like & (bitwise
and) and ++ (autoincrement).  Even worse, a scalar can be a reference to an array
or a hash or an object and this is only checked at runtime.

2 - You can't make a user defined type, like classes in Java, that are compile
time checked.

There are many other examples.

Daniel


John Porter wrote:

> Perl has strong typing; it just has a different notion of
> what a "type" is.  The "types" in Perl are SCALAR, ARRAY,
> HASH, CODE, and a few others.  Watch:
>
> % perl -e 'sub foo(\@){} foo %h'
> Type of arg 1 to main::foo must be array (not hash deref) at -e line 1, at EOF
> Execution of -e aborted due to compilation errors.
>
> --
> John Porter
>
> "Anything essential is invisible to the eyes."

Reply via email to