Cushion the state transition table library released

ag0aep6g anonymous at example.com
Wed Jun 26 15:20:45 UTC 2019


On 26.06.19 16:01, SHOO wrote:
> GitHub: https://github.com/shoo/cushion

You've got bad `@trusted`s.

Quoting from there:
> pragma(inline) T trustedCast(T, Arg)(Arg arg) @trusted
> {
> 	return cast(T)arg;
> }

No.

> pragma(inline) void call(Handler, Args...)(ref Handler handler, Args args) @trusted
> {
[...]
> 				handler(args);

Noo.

> pragma(inline) void add(Handler, Func)(ref Handler handler, Func func) @trusted
> {
[...]
> 		handler ~= func;
[...]
> 		handler.insert(func);
[...]
> 		handler.connect(func);

Nooo.

> pragma(inline) void remove(Handler, Func)(ref Handler handler, Func func) @trusted
> {
[...]
> 		__traits(getMember, handler, "remove")(func);
[...]
> 		handler.disconnect(func);
[...]
> 		handler.linearRemoveElement(func);

Noooo.

> struct StateTransitor(
[...]
> 	EventContainer = SList!EventType)
> {
[...]> 	EventContainer               _events;
[...]
> 	void consume() @safe
> 	{
[...]
> 		() @trusted
> 		{
[...]
> 				_events.removeFront();
[...]
> 		}();
> 	}

Nooooo.


More information about the Digitalmars-d-announce mailing list