[OT] Perl woes and types

Ovid publiustemp-londonpm at yahoo.com
Wed Jan 28 15:27:18 GMT 2009


----- Original Message ----

> From: James Laver <james.laver at gmail.com>

> That's because python is strongly typed (though not statically typed
> -- it's a dynamic language).

No offense, but "strongly typed" doesn't have a huge amount of meaning, though statically typed does.  I highly recommend:

  http://www.pphsg.org/cdsmith/types.html

That's a great overview of the basics of type systems.

The problem with "strongly" and "weakly" typed is that different people define them differently and they don't have much meaning in type systems.  It's static typing and dynamic typing which is important.

I *think* what you're describing as "strongly typed" is "a variable can hold different types, but that operators change their behavior at runtime:

  #!/usr/bin/env python

  foo = 3
  bar = 3
  print foo + bar

  foo = 'bar'
  bar = 'foo'
  print foo + bar

Output:

  6
  barfoo

I think a few people would take exception to this being characterized as "strongly typed" :)  (but that's only because they're defining it differently than you are).  Many who use the term "strongly typed" would argue that a variable also has a type (i.e., both the container and the variable have a type) and that you cannot assign data with a different type to it.

Cheers,
Ovid
--
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