Andrei's list of barriers to D adoption

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 7 14:28:27 PDT 2016


On 6/7/16 5:10 PM, Jonathan M Davis via Digitalmars-d wrote:
> On Tuesday, June 07, 2016 20:52:15 Dave via Digitalmars-d wrote:
>> On Tuesday, 7 June 2016 at 20:48:13 UTC, Jonathan M Davis wrote:
>>> On Tuesday, June 07, 2016 18:33:01 Dave via Digitalmars-d wrote:
>>>> [...]
>>>
>>> IMHO, it's bad practice to mass apply attributes with labels or
>>> blocks. It's far too easy to accidentally mark a function with
>>> an attribute that you didn't mean to, and it makes it way
>>> harder to figure out which attributes actually apply to a
>>> function. And when you add templates into the mix, applying
>>> attributes en masse doesn't work anyway, because pretty much
>>> the only time that you want to mark a template function with an
>>> attribute is when the template arguments have nothing to do
>>> with whether the attribute is appropriate or not.
>>>
>>> [...]
>>
>> So we should not follow the advice of Walter?
>
> If he's arguing that you should slap an attribute on the top of your
> module to apply to everything, then no, I don't think that we should follow
> his advice. He's a very smart guy, but he's not always right. And in my
> experience, mass applying attributes is a mistake.
>

The original(?) complaint was that it's hard to grep for @system because 
it's the default.

I think the advice is to put the attribute at the top to see where your 
non-conforming code lies. Not as a permanent fixture.

I can attest that figuring out why something isn't inferred @safe isn't 
always easy, and the "slap a @safe: tag at the top" isn't always going 
to help. But it can be a technique to find such things.

-Steve


More information about the Digitalmars-d mailing list