@trusted attribute should be replaced with @trusted blocks

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jan 16 01:32:23 UTC 2020


On Thu, Jan 16, 2020 at 01:07:21AM +0000, Paul Backus via Digitalmars-d wrote:
> On Wednesday, 15 January 2020 at 14:30:02 UTC, Ogi wrote:
[...]
> > If a function expects a @safe callback, you can’t pass a @trusted
> > function to it without @safe wrapping.
[...]

Hogwash. Did you even test this before making statements like that?

	void fun(void function() @safe dg) { }

	void trustme() @trusted { }

	void main() {
		fun(&trustme);
	}

Compiles fine.


[...]
> However, both of these issues can be fixed without a huge overhaul of
> @trusted. The type-system issue can be fixed by introducing implicit
> conversions between @safe and @trusted functions, and the ABI issue
> can be fixed by changing how @trusted affects name mangling.

@trusted *already* implicitly converts to @safe.  We're arguing over
nothing here.


T

-- 
Two wrongs don't make a right; but three rights do make a left...


More information about the Digitalmars-d mailing list