in reply to Re^5: Interesting read: "Why I use perl and still hate dynamic language weenies too" (heterogeneous lists)
in thread Interesting read: "Why I use perl and still hate dynamic language weenies too"

When you talk about an "untyped" language such as Perl, I think what you really mean is "uni-typed". There is only one type, the tagged scalar. This can be tagged as a regular scalar or as a reference and used in various ways, but at heart there is only one type in the language. That's why pack knows what to do with any value you throw at it; it takes a list of tagged scalars and creates a string according the the tags and values.

When you make a "general-purpose" function in a typed language with a powerful type system, you can have all of the convenience of a uni-typed language and the compile-time checking of a typed language. For an example,see Haskell/Existentially quantified types.

Bottom line, it seems to me that the problems we Perlish people have with static languages come from the fact that many type systems are not as rich as they should be (C, Java). From what I've seen, ML and Haskell are moving toward the flexibility we need.

~dewey
  • Comment on Re^6: Interesting read: "Why I use perl and still hate dynamic language weenies too"

Replies are listed 'Best First'.
Re^7: Interesting read: "Why I use perl and still hate dynamic language weenies too"
by chromatic (Archbishop) on Apr 17, 2007 at 17:40 UTC
    There is only one type, the tagged scalar.

    Your programs are about to get a lot more useful; Perl supports arrays and hashes too!

      What?? My life just got so much easier! ;)

      But seriously, if I'm confused about this maybe you can clear it up. Is Perl statically typed, dynamically typed, or some crazy other thing that I don't know about?

      Perl does "support arrays and hashes", but I was always under the impression that this was a run-time check on tagged values (dynamic) rather than a compile-time check on untagged values (static). Are we saying that Perl is statically typed, where the types are scalar, hash, and array? If it's truly dynamically typed, how can these distinctions arise?

      Thanks for your help.

      ~dewey

        SV (scalar), AV (array), HV (hash), GV (glob), etc are different, independent structures. Different opcodes are used to interact with them. For example, padsv is used to fetch an SV lexical, while padav is used to fetch an AV lexical.

        SVs can be IV (signed int), UV (unsigned int), NV (decimal number), PV (string), RV (reference), etc. It can even be certain combinations of those. What you said in your earlier post does apply to scalars.