removal of cruft from D

dsimcha dsimcha at yahoo.com
Mon Nov 23 09:14:54 PST 2009


== Quote from bearophile (bearophileHUGS at lycos.com)'s article
> Don:
> > There seems to be no point in having a *single* integer value, shared
> > between the app and all libraries! It's just reducing future flexibility.
> It doesn't reduce flexibility at all, because if you need something more complex
you don't use it and nothing bad happens. You can even ignore it.
> You are thinking about 10000+ lines long apps; about scaling up. I am thinking
about single-module 500-lines long programs that replace some scripts; about
scaling down too.
> A compilation constant avoids me to modify the source every time I need to
change the size of some static array/matrix. With that I just need a second Python
script that calls dmd/ldc with a different argument, instead of a little more
complex Python script that changes the source code of the D program, to modify the
constant.
> A very modern language like Fortress, designed for physics, has that small
feature :-) (It's available in C too, only integer/symbol constants).
> Bye,
> bearophile

I just have to say it:  Vote++ for the scaling down thing.  I think D is about the
only language on the planet that cares about both scaling up to huge million line
applications and scaling down to small 500-line scripts.  This is surprisingly
important to me because the small 500-line scripts are often the kind of code
where I (and probably other people, too) are less afraid to experiment with things
and therefore to really learn some of the details of the language and standard
lib.  I actually got my start with D by writing very small programs that needed to
be fast, faster than dynamic scripting languages could handle well.  If D were as
unnecessarily verbose as, say, Java, for writing small programs I would likely
have blown it off as unnecessarily complex before I even learned it in any depth.

Furthermore, trying to scale down to the 500 line script level really forces us to
think about making simple things simple, as opposed to the Java way of having to
use 5 different classes just to read in a file line by line in the default
character encoding.

Lastly, I see the scaling down thing as valuable because you can write really
complicated libraries in D, and then call them from really simple scripts with no
horribly messy glue layer or unnecessary complexity getting in the way.  I do this
quite often.  Even for some fairly simple math stuff, I actually find D + Phobos +
my dstats lib as easy or easier to use than DSLs like R or Matlab.



More information about the Digitalmars-d mailing list