[article] Language Design Deal Breakers

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Sat May 25 19:28:24 PDT 2013


On Sat, 25 May 2013 17:14:13 -0700
Jonathan M Davis <jmdavisProg at gmx.com> wrote:

> On Sunday, May 26, 2013 01:54:36 Timon Gehr wrote:
> > On 05/26/2013 01:39 AM, Jonathan M Davis wrote:
> > > On Sunday, May 26, 2013 00:50:28 Klaim - Joël Lamotte wrote:
> > >> I think this have not been posted yet around here but might be
> > >> interesting
> > >> to the D community as it is actually criticizing several
> > >> languages including D but with an interesting aproach:
> > >> 
> > >> http://sebastiansylvan.wordpress.com/2013/05/25/language-design-deal-brea
> > >> ker s/
> > > 
> > > Interesting article, with a lot of good points, though I don't at
> > > all agree
> > > with his take on unit testing or null pointers.
> > > 
> > > - Jonathan M Davis
> > 
> > What is there to disagree with about the null pointer issue?
> 
> I completely disagree that null pointers are a problem. I don't even
> remember the last time that I dereferenced a null pointer in my code,
> and I think that null can be extremely useful. And yet for whatever
> reason, there are quite a few people who seem to think that it's a
> great cause for bugs. Clearly, they're doing something differently
> than I do.
> 
> Regardless, I don't really want to get into that (there was a
> discussion on it quite recently). Suffice it to so that I don't find
> null pointers to be a problem and am confused at how so many people
> manage to have problems with them.
> 

That's been my experience, too. I definitely would love to have a
nice convenient featherweight type that forces checking-for-null
and then, if ok, emits a type that's statically non-nullable. But that
said, I don't run into null dereferences (in D anyway) nearly as much
as I expect I should.

But, for much the same reason, I am somewhat with the author on
unittests. I definitely find them very important and worthwhile, but my
experience is in-line with "writing unit tests **for everything** very
frequently fails the bang-for-buck test" (emphasis added).

In something nicely static-typed like D, most tests never end up
failing, and actual applications do end up implicitly testing a heck
of a lot anyway. Of course, this doesn't imply that unittests aren't
extremely worthwhile (and I don't think even the author was claiming
otherwise), and unittests have indeed helped me a good deal, but I do
think they definitely have a "point of diminishing returns".

That said, good unittesting tends to be much more important for
libraries. And in dynamic-land, then yea, you probably are royally
screwed if you haven't pedantically unittested the crap out of every
single line of code, under every context and runtime type imaginable.



More information about the Digitalmars-d mailing list