Rant after trying Rust a bit

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 25 05:05:16 PDT 2015


On 7/23/15 3:50 PM, H. S. Teoh via Digitalmars-d wrote:
> On Thu, Jul 23, 2015 at 12:49:29PM -0700, Walter Bright via Digitalmars-d wrote:
>> On 7/23/2015 7:15 AM, Andrei Alexandrescu wrote:
>>>> I am a bit puzzled by the notion of shipping template code that has
>>>> never been instantiated as being a positive thing. This has also
>>>> turned up in the C++ static_if discussions.
>>>
>>> This is easy to understand. Weeding out uncovered code during
>>> compilation is a central feature of C++ concepts. Admitting you
>>> actually never want to do that would be a major blow.
>>
>> But if a unit test fails at instantiating it, it fails at compile
>> time.
>
> That assumes the template author is diligent (foolhardy?) enough to
> write unittests that cover all possible instantiations...

Well at least all paths must be compiled. You wouldn't ship templates 
that were never instantiated just as much as you wouldn't ship any code 
without compiling it. We've had a few cases in Phobos a while ago of 
templates that were never instantiated, with simple compilation errors 
when people tried to use them. -- Andrei



More information about the Digitalmars-d mailing list