Re: @trusted methods

2021-06-18 Thread ag0aep6g via Digitalmars-d-learn
On 18.06.21 14:40, vit wrote: Are asserts enough to make method @trusted or is something like throw exception or return error code necessary? Asserts are a debugging feature. They're not suitable to ensure safety, because they're simply skipped in release mode. `assert(false);` is the

@trusted methods

2021-06-18 Thread vit via Digitalmars-d-learn
Are asserts enough to make method @trusted or is something like throw exception or return error code necessary? How it work in phobos? Example: ```d struct Slice(T){ private T[] data; this(T[] data){ this.data = data; } inout(T)[] opSlice()inout scope return