all OS functions should be "nothrow @trusted @nogc"
Shachar Shemesh via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jul 31 07:15:34 PDT 2017
On 31/07/17 17:08, Timon Gehr wrote:
> On 31.07.2017 15:56, Shachar Shemesh wrote:
>>
>> One of the things that really bother me with the D community is the
>> "100% or nothing" approach.
>> ...
>
> Personally, I'm more bothered by this kind of lazy argument that sounds
> good but has no substance.
>
>> System programming is, by definition, an exercise in juggling
>> conflicting aims. The more absolute the language, the less useful it
>> is for performing real life tasks.
>
> Why do you think @trusted exists?
That's fine, but since, according to the logic presented here, no OS
function can ever be @safe, then all code calling such a function can't
be @safe either. At this point, half your code, give or take, is
@trusted. That's the point you give up, and just write everything as
@system.
And what we have here is that you started out trying to be 100% pure
(and, in this case, there is no problem with current code, only
*hypothetical* future changes), and end up not getting any protection
from @safe at all.
There is a proverb in Hebrew that says:
תפסת מרובה, לא תפסת.
Try to grab too much, and you end up holding nothing.
Shachar
More information about the Digitalmars-d
mailing list