Not quite. Realize that the definitions of "strong" and "static" typing are orthogonal, and I wish there was a completely different terminology used, since they are so easily confused. "Strong" means you can't convert between the types easily. "Static" means the compiler has some idea of what the type is. "Weak" is the opposite of "strong", and "dynamic" is the opposite of "static".
Since you can't convert an array into a scalar, this aspect of Perl is strongly typed. Since a scalar can hold pretty much anything (strings, numbers, references, etc.), this aspect is dynamically typed.
Static typing, IMHO, is extremely overrated. Since many statically typed languages make it easy to cast one type into another, you can't trust it to be anything more than an optimization hint.
----
: () { :|:& };:
Note: All code is untested, unless otherwise stated
| [reply] [d/l] |
| [reply] |
Howdy!
That depends on what you mean when you say "type". I chose
to set the values for "type" as "scalar", "array", and
"hash", being the fundamental data types (and ignoring
some other, more esoteric, flavors). The number/string
distinction is, in my consideration, not a part of the
"type"; numbers and strings are each scalars.
Think of them as an external representation. Some data may
not have a meaningful numeric representation, but consider
also a hex representation as another flavor. Regardless of
the representation, the datum is a single item -- a scalar.
It may be an encoding of multiple values that can be
teased apart, but that, again, does not make it then a
hash or an array.
| [reply] |