The "type" type dream

bearophile bearophileHUGS at lycos.com
Tue Nov 25 13:51:43 PST 2008


Michel Fortin:
> Unifying templates and functions... hum, I'm probably still dreaming.

I suggest you to take a good look at Haskell :-) Its type systems is Turing-complete, you can really use it to do many kinds of things, including the ones you dream about now, and much more complex ones too you currently aren't able to dream about yet :-)

While we are at this: from this post and the last posts about 'Unification and extension of compile-time reflection' I can see that probably D may also enjoy a bit more refined pattern matching capabilities (on values and types too). Scala and OcaML languages show few examples of this, but again you can look at Haskell for something better.

>From what I've seen so far if you want a very flexible language there are two solutions:
1) you can attach types to values, and manage types at runtime, ending with dynamic languages like Ruby, Python, Scheme, CLips, tcl, and so on.
2) Otherwise you probably need a very flexible static type system, with strong type-inferencing capabilities, and capable to manage types is a refined way. A Hindley–Milner type inference algorithm may suffice:
http://en.wikipedia.org/wiki/Type_inference#Hindley.E2.80.93Milner_type_inference_algorithm
http://web.archive.org/web/20050911123640/http://www.cs.berkeley.edu/~nikitab/courses/cs263/hm.html

Bye,
bearophile



More information about the Digitalmars-d mailing list