Language design (Was: Re: Use case for std.bind)

bearophile bearophileHUGS at lycos.com
Tue Feb 24 12:23:34 PST 2009


Andrei Alexandrescu:
> There's a much stronger bias to add than remove,

Yes, unfortunately with time most (or all) languages tend to grow, and to become more complex and hairy. And often there's no way to fix this problem, the complexity keeps growing, until people want to create a better new language that finds better ways to do most of those things with less complexity.

Even in language communities that value language simplicity and clarity above almost everything else like the Python community, where they are even willing to break the high-valued backward compatibility, they have created Python3 that removes as many warts and duplicated features as possible, yet, Python3 is more complex than Python 2.5 still.

One of the big intrinsic disadvantages of the C++ and D languages is that they have a lot of near-duplicated features, one feature from C and one new way to do essentially the same thing. This of course has some advantages (C compatibility first of all, but also the old C features are often the more efficient ones, when you really need max performance).

Regarding binding and currying and other functional features, you/we have to decide the future taste of D2. If people want to make D2 more functional-tasting, then some functional features may be better as built-ins.

Regardless your choice, I suggest all D designers to often look at the Scala language (and F#, if you want) (and to not look at Java much anymore). Scala is far from perfect, and in some regards may already be too much complex, but it shows interesting ways to mix OOP, mutation, actor-based multiprocessing, and strong functional features with a type system much more refined than the current one used in D2. So it partly shows how D2 or D3 may look.

To be more precise, I now think D2 doesn't need much the pattern matching (because it's useful but it also adds a significant amount of complexity to the language), but it may enjoy to gain Algebraic Data Types (http://en.wikipedia.org/wiki/Algebraic_data_type ), more than AST macros. ADTs too add complexity and require a more complex type system, but they allow a functional-flavored language (as Scala, F#, Ocaml, and many pure-FP languages) to express several things in a quite compact way, add power to the language, etc :-)

Bye,
bearophile



More information about the Digitalmars-d mailing list