Quantcast
Channel: Object Mentor Blog: Outliving The Great Variable Shortage
Viewing all articles
Browse latest Browse all 26

"Outliving The Great Variable Shortage" by mgsloan

$
0
0

Take a look at the hindley milner type system. It’s got your requirement of having a specific domain down, yet disagrees with your multiple kinds judgement. I suppose that repurposing and able to take on multiple forms may not be exactly the same thing, yet one type, one variable, may hold entirely different data. And we’re talking about one of the most exactingly defined and implemented type systems.

Basically every type’s domain is a sum and product of other types. You seem to agree with the product part, yet disagree with the sum part. Then again, this is likely an attack more on dynamically typed languages, in which case functional programming is fairly well behind you.

One thing that languages often lack is a concise, well specified generics system. In haskell, it’s called type parameters. This allows for constructing new types by composing types together. For example, the Maybe T type-constructor has a domain of Just T and Nothing, basically adding one value to T’s domain to construct Maybe T. This very nicely encapsulates the concept of Null used in other languages.

Tim writes:Thanks for the H/M type system pointer. I’m digging in. And no, I tend not to attack any dynamically typed languages, as I have a strong preference for strongly, dynamically-typed languages like Python. I should get to know more of them.


Viewing all articles
Browse latest Browse all 26

Trending Articles