Greenwashing

Steven Schveighoffer schveiguy at gmail.com
Thu May 28 15:00:11 UTC 2020


On 5/28/20 3:36 AM, Paolo Invernizzi wrote:
> On Thursday, 28 May 2020 at 01:23:31 UTC, Steven Schveighoffer wrote:
>> On 5/27/20 8:31 PM, Jonathan M Davis wrote:
>>> On Wednesday, May 27, 2020 5:57:00 PM MDT Meta via Digitalmars-d wrote:
>>>> On Wednesday, 27 May 2020 at 18:50:50 UTC, Jonathan M Davis wrote:
>>>>> Based on some of Walter's comments, it also sounds like he
>>>>> intends to make nothrow the default in another DIP, which is
>>>>> also a terrible idea. I'm increasingly worried about the future
>>>>> of D with some of where these DIPs are going.
>>>>>
>>>>> - Jonathan M Davis
>>>>
>>>> What's wrong with nothrow by default? Probably 97% of code
>>>> doesn't need to throw exceptions.
>>>
>>> If anything, I would say the opposite.
>>
>> It actually doesn't matter what's more common (and I agree with 
>> Jonathan, there's actually a lot of throwing calls because of the 
>> calls that you make into other functions). What matters is that there 
>> are functions that are actually nothrow that aren't marked nothrow. 
>> Hence the desire that these functions should actually be marked 
>> nothrow implicitly so people who care about that can just use the 
>> functions without issue.
>>
> 
> What make me feel "mhmm" is that the motivation is always "because no 
> throw is speediest, so should be the default" ...

That's not the motivation for the default.

throwing code can call nothrow code. Nothrow code cannot call throw code 
(without doing something about the exceptions). If code is actually 
nothrow (meaning it does not ever throw any exceptions) but not marked 
as nothrow, then it's an attribute away from being more useful.

If we make nothrow the default, then code that already is nothrow, but 
simply not marked, now becomes more useful.

Same goes for @safe, @nogc, pure.

This is about properly marking code, not about speed.

But I'm thinking we are approaching this wrong. We should simply make 
inference the default, and opt out by using an attribute or some other 
mechanism (pragma?). It would have the same effect but not break all 
code in existence.

-Steve


More information about the Digitalmars-d mailing list