dynamic classes and duck typing

dsimcha dsimcha at yahoo.com
Wed Dec 2 07:25:51 PST 2009


== Quote from retard (re at tard.com.invalid)'s article
> I thought D was supposed to be a practical language for real world
> problems. This 'D is good because everything can and must be written in
> D' is beginning to sound like a religion.

You're missing the point.  Mixing languages always adds complexity.  If you want
the languages to talk to each other, the glue layer adds complexity that has
nothing to do with the problem being solved.  If you don't want the languages to
talk to each other, then you're severely limited in terms of the granularity at
which they can be mixed.  Furthermore, it's nice to be able to write generic code
once and have it always "just be there".

I get very annoyed with languages that target a small niche.  For example, I do a
lot of mathy stuff, but I hate Matlab and R because they're too domain-specific.
Anytime I write more than 20 lines of code in either of these, I find that the
lack of some general-purpose programming capability in these languages or the
awkwardness of using it has just added a layer of complexity to my project.

Even Python runs out of steam when you need more performance but you realize what
a PITA it is to get all the glue working to rewrite parts of your code in C.
Heck, even Numpy sometimes feels like a kludge because it reimplements basic
things like arrays (with static typing, mind you) because Python's builtin arrays
are too slow.  Therefore, Numpy code is often not very Pythonic.

A practical language should have enough complexity management tools to handle
basically any type of complexity you throw at it, whether it be a really
complicated business model, insane performance requirements, the need to scale to
massive datasets, or the sheer volume of code that needs to be written.  Making
more assumptions about what problems you want to solve is what libraries or
applications are for.  These complexity management tools should also stay the heck
out of the way when you don't need them.  If you can achieve this, your language
will be good for almost anything.



More information about the Digitalmars-d mailing list