Truly algebraic Variant and Nullable

9il ilyayaroshenko at gmail.com
Tue Dec 22 17:17:26 UTC 2020


On Tuesday, 22 December 2020 at 17:07:16 UTC, ag0aep6g wrote:
> On Tuesday, 22 December 2020 at 16:54:56 UTC, 9il wrote:
>> On Tuesday, 22 December 2020 at 16:43:30 UTC, ag0aep6g wrote:
> [...]
>>> [...]
>>
>> If I am correct Dlang doesn't provide an instrument to 
>> validate it, isn't it?
>>
>> What alternative is possible?
>>
>> Returning it by value isn't acceptable at least because of 
>> performance reasons: the first target of the library is struts 
>> with a lot of Mir ref-counted fields.
>
> Mark it @system then.
>
>>> [...]
>>
>> This is why it is the market as `trusted`. It is much more 
>> convenient than forcing users to wrap each access with 
>> @trusted lambda, which feels like masochism.
>
> @trusted makes the exact same promise to the user as @safe.
>
> If your method doesn't have a safe interface, don't mark it 
> @safe or @trusted. Mark it @system.

Hmm, maybe it worth changing the API a bit. Needs to wait for 
mir-core 1.2.x thought.


More information about the Digitalmars-d-announce mailing list