Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Perl's static type system cares more about containers than values. Ponder that for a while, if you really want to confuse the debate.

    • That's actually a point explicitly raised in the article. Dynamic systems focus tracking what kinds of data are used in a system, not on syntactic evaluation of expressions. See the "Problems with Common Definitions" section which begins with this:

      One common saying, quoted often in an attempt to reconcile static and dynamic typing, goes something like this: Statically typed languages assign types to variables, while dynamically typed languages assign types to values. Of course, this doesn't actually defin

      • That's not quite the same. Perl 5's built-in static types are scalar, array, and hash (and Maybe reference, if you pardon the Haskellish pun). You do get compile-time checks on using them appropriately.

        • While those three are what most people are aware of using, Perl 5 has more static types than that. For example typeglobs. Perl 5 also has a parallel static type system in its attribute system.

          That said, the article did not draw the usual simplistic divisions. And made a point of saying that many languages have both static and dynamic systems, but usually one is more fully developed. Meaning that there are classes of problems that can be solved either through a dynamic type system or a static type system

          • However the complex things that you'd want from a type system are mostly done with dynamic typing in Perl.

            Wouldn't it be more fair to that that the things we think we want from a type system are done with dynamic typing in Perl? Since, as the author points out, you can capture and verify domain specific knowledge via a static type system (see the paper on using static types in Haskell to verify that a database is normalized), it appears that what people are typically doing with static types is rather generic, but their advanced expressiveness (such as catching infinite loops) is not possible with Perl 5, Pytho

            • by btilly (5037) on 2008.07.30 8:05 (#64104) Journal

              I didn't say all, I said mostly.

              It is true that an advanced static typing system can do things you simply can't do within Perl 5. On the other hand duck typing allows things that can't be easily done within a static system. Think Test::MockObject and Test::MockObject::Extends.

              However the majority of the day to day utility that most people want from a type system can be delivered either way. It is possible that if more people knew what was possible then our wants could change and that would no longer be true. But I happen to personally doubt it.

              For example take the normalized database logic done in the type system. I like the idea of normalized databases as much as the next person. But my job is handling reporting. For reporting purposes it is standard to build deliberately denormalized aggregate tables for faster querying. No matter how clever it may be, I do not want to fight a type system that has decided to give me unwanted and unnecessary guarantees on how well normalized my deliberately denormalized data is.

              Besides, I know SQL pretty well, and I regularly use advanced SQL features that most people don't. (You don't need to know that much to do more than most people. It is amazing what you can accomplish in Postgres by creating a series of temp tables and liberally using CASE statements where appropriate.) As a result the kind of query generators that I suspect this Haskell hack requires (I would read the paper except it looks like it is in Spanish) tend to get in my way. Besides even if Haskell's type system doesn't allow it, SQL allows casting, and casting is sometimes very important to do.

              • Actually, the paper appears to start with Portuguese for the introduction, but the paper itself is in English. That threw me off, too. Aside from that, your points are well taken.