Tango vs Phobos

bearophile bearophileHUGS at lycos.com
Mon Aug 11 14:11:27 PDT 2008


Sean Kelly:
> It's just a matter of opinion, I suppose.  As D is a systems language, I don't
> agree with many arguments about safety when that safety conflicts with my
> ability to control what the language is doing behind the scenes.

I agree that:
- a system language has to be efficient;
- there must be a short, readable and nice way to disable heap allocation of closures (that I think has to happen by default);
- that sometimes safety has to be put aside (that's why I have said "practically possible": if a safe feature slows down code too much it's not much fit for a system language, especially when compiling in release mode).
- I'm using D instead of Python because sometimes I need a modern language that runs my programs faster (this isn't a system purpose).

Despite that, there are tons of situations where a "fast language" can help avoid bugs with little or no performance penalty (and adding a statement to disable the heap allocation of closures leads to no performance penalty).

Examples of other possible improvements:
foreach (i, x in array)
instead of:
foreach (i, x; array)
(But people here have explained me that despite this being better for the programmer it's worse for the compiler, making it more complex etc, and in the end a worse compiler is bad for the programmer too).

Or a switch() statement with a semantic safer than then C switch, or various other things that help you decrease bug count and on average produce a correctly running code in less time :-)


> Portability between versions is also an issue--code that is correctly designed for D 1.0 may be unusable on D 2.0 because the default behavior for certain language features is different, although the syntax is still completely legal.<

I have written a library that despite being surely tiny compared to Tango, is currently already 817 KB of code, with no redundancy inside, and it's written for D 1.x, so I understand your pain of porting things to D 2.x.

Despite this, D is a young language still, and it's developing quickly still, so it's too much early now to impose too many backward constraints... D 1.x may die and be forgotten, and maybe D 2.x too (Walter already says that AST macros are for D 3.x) so every current big lib for D will probably need one or two major rewrites. In 5 years we may have CPUs with several cores, that the currently mostly-sequential code used in my libs and Tango will be partially obsolete, that may require large changes in the libs and maybe in the language too...

Bye,
bearophile



More information about the Digitalmars-d mailing list