C++ guys hate static_if?
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Thu Mar 14 10:43:24 PDT 2013
On Thu, 14 Mar 2013 11:38:52 -0400
Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> On 3/14/13 11:05 AM, monarch_dodra wrote:
> > Having to instantiate a template just to check to make sure it is
> > semantically correct is a huge pain.
>
> I'm not sure about that. The way I see it, no code should be not
> delivered without being unittested. Ubiquitous unittesting is now
> mainstream. The way I see it, a type system on top of templates would
> only help people who don't write unittests.
>
What the hell is this, a JS/Python forum all of a sudden? You're
literally making the exact same argument as "We don't need no steenkin'
static type checking."
On Thu, 14 Mar 2013 13:07:16 -0400
Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>
> Very simple. Traditionally there's two crucial epochs known as
> compilation time and run time. (There's some minor distinctions like
> link time etc.) The whole notion of concepts and other type systems
> for templates is predicated on three crucial epochs: library
> compilation time, library user compilation time, and run time. The
> logic goes, someone writes a generic library and wants to distribute
> it to users. Users shouldn't ever see bugs caused by e.g. typos in
> the library.
>
> So the crowd that use meta-type systems is formed of library writers
> who want to distribute libraries without ever instantiating them. I
> don't think that's a good crowd to cater for.
>
> I've been surprised to figure how many people don't get this flow, or
> only have a vague image of it. Although meta-types are arguably "the
> right thing" to do, they're a lot less attractive once it's clear
> what scenarios they help.
>
That's because the flow is completely wrong. Particularly so in the
context of a static-typed language. Where do I start?:
- The branch of the discussion you're replying in has nothing to do
with meta-types and yet you seem to be arguing on the false dichotomy
of "Introduce meta-types vs no static checks on templates without
instantiation". Please check the link in Don's post a few replies up.
- "...library writers who want to distribute libraries without ever
instantiating them..." is a hyperbolic strawman. Do you really expect
us to believe that you and other respectable coders, let alone
ordinary coders, *never* miss an instantiation? Of course not, and
we both know that. So don't insult us by trying to paint this out as
some "it only helps/encourages the lazy" bullshit.
- We're talking a static-typed language here. The philosophy that "it's
better to catch a whole class of errors as early regardless of
whether the code in question gets used than to delay the check until
a point where it may or may not get caught" is already a given. We're
not Python here.
More information about the Digitalmars-d
mailing list