Is D a cult?

bearophile bearophileHUGS at lycos.com
Sun Mar 7 12:50:50 PST 2010


In this post I am *not* asking for new features in D, I just try to give few answers :-) I think most of those things are not fit for D, they require a different language, a different compiler, different programmers, and probably a different compiler writer too :-) (I think in D for example list comphrensions fit better).

The problem is that I am not an expert on such things, so what I say is not fully reliable (and another smaller problem is that I am not always sure what retard meant). If you don't understand or you don't agree with something I write here please ask.


Walter Bright:

>>- Built-in variants (real sum types)<<

>std.variant works fine. Don't know how having them be built-in would improve things.<

I think retard here meant something different from D variant type.
I think he meant something like the type int|float or int|float|double.

The type system then knows that a variable of such type can contain only an int or a float, and nothing else. So you can think of it as a tagged union. But it's not just a C tagged union, functional languages are able to manage such int|float type very well, for example accepting in the code only operators that are allowed on both types.


>>- Fusion optimizations (e.g. list and stream fusion)<<

>Andrei demonstrated how to do this neatly with ranges.<

I think Andrei was showing something different. You can think of Fusion optimization as a compiler optimization, done by good compilers of lazy functional languages :-)
It's useful to remove some useless operations, and turn a certain not effient functional algorithm into something that runs fast.

You can find something here:
http://stackoverflow.com/questions/578063/what-is-haskells-stream-fusion
(In my opinion D language is far from being in need of this optimization.)


>>- Algrebraic data types<<

>std.variant covers this.<

I am sorry, but std.variant has nothing to do with Algrebraic data types :-) (The words retard has used come from computer science still, but it's another dialect, of the functional programmers. So even things that sound similar can be quite different things).
I have shown Algrebraic data types a little on this newsgroup once in the past.

This page contains some information:
http://en.wikipedia.org/wiki/Algebraic_data_type



>>- Type classes<<

>Don't know what this is.<

This page gives some basic information:
http://en.wikipedia.org/wiki/Type_classes
While you read that, keep in mind the difference between a Nominative type system like the D one, and a structural one like the one of Haskell:
http://en.wikipedia.org/wiki/Nominative_type_system



>>- Higher kinded types<<

>Don't know what that is.<

This is quickly going into a mess. There are very few languages with those, maybe only Haskell and Scala.
You can find some information here, but it's not easy read:
http://en.wikipedia.org/wiki/Kind_%28type_theory%29
http://www.cs.kuleuven.be/~adriaan/files/higher.pdf

I'll need few more years to start to start to digest some of this stuff.

Bye,
bearophile



More information about the Digitalmars-d mailing list