Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
June 26, 2019 Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Cushion is a library for managing state transition by state transition table design. This library parses CSV format tabular file described the design of states passed by string import and generates D language code. It can be used with string mixin. It may be useful if you are dealing with a program that changes behavior depending on the state. Thanks! DUB: https://code.dlang.org/packages/cushion GitHub: https://github.com/shoo/cushion |
June 26, 2019 Re: Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | 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. |
June 27, 2019 Re: Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On Wednesday, 26 June 2019 at 15:20:45 UTC, ag0aep6g wrote: > 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; >> } > [...] > > Nooooo. Thank you for your technical review. You can report new issues on GitHub: https://github.com/shoo/cushion/issues Or, you may also create a pull request: https://github.com/shoo/cushion/pulls |
June 27, 2019 Re: Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | 27.06.2019 13:52, SHOO пишет:
> Thank you for your technical review.
> You can report new issues on GitHub: https://github.com/shoo/cushion/issues
> Or, you may also create a pull request: https://github.com/shoo/cushion/pulls
IMHO, this is unusual for D community to make review in such form. I hope it won't repeat. Thank you for your patience.
|
June 27, 2019 Re: Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On Wednesday, 26 June 2019 at 15:20:45 UTC, ag0aep6g wrote:
> On 26.06.19 16:01, SHOO wrote:
>> [...]
>
> You've got bad `@trusted`s.
>
> Quoting from there:
>> [...]
>
> No.
>
>> [...]
> [...]
>> [...]
>
> Noo.
>
>> [...]
> [...]
>> [...]
> [...]
>> [...]
> [...]
>> [...]
>
> Nooo.
>
>> [...]
> [...]
>> [...]
> [...]
>> [...]
> [...]
>> [...]
>
> Noooo.
>
>> [...]
> [...]
>> [...]
> [...]> EventContainer _events;
> [...]
>> [...]
> [...]
>> [...]
> [...]
>> [...]
> [...]
>> [...]
>
> Nooooo.
I really love that you go in to the code and find things like this, especially when it comes to abuse of @trusted, but maybe a little explanation as to why would be more helpful to the OP ;)
|
June 28, 2019 Re: Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Posted in reply to aliak | On 27.06.19 23:34, aliak wrote:
> I really love that you go in to the code and find things like this, especially when it comes to abuse of @trusted, but maybe a little explanation as to why would be more helpful to the OP ;)
Probably. But this isn't D.learn, and I'm getting tired of explaining @trusted.
I don't want to discourage anyone from writing libraries and showing them off here, but I do want to discourage people from writing @trusted code.
|
June 28, 2019 Re: Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On Thursday, 27 June 2019 at 22:36:14 UTC, ag0aep6g wrote:
> On 27.06.19 23:34, aliak wrote:
>> I really love that you go in to the code and find things like this, especially when it comes to abuse of @trusted, but maybe a little explanation as to why would be more helpful to the OP ;)
>
> Probably. But this isn't D.learn, and I'm getting tired of explaining @trusted.
Would you consider writing a blog post about it? I'm sure it would be helpful to a lot of people.
|
June 28, 2019 Re: Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On Thursday, 27 June 2019 at 22:36:14 UTC, ag0aep6g wrote:
> On 27.06.19 23:34, aliak wrote:
>> I really love that you go in to the code and find things like this, especially when it comes to abuse of @trusted, but maybe a little explanation as to why would be more helpful to the OP ;)
>
> Probably. But this isn't D.learn, and I'm getting tired of explaining @trusted.
>
> I don't want to discourage anyone from writing libraries and showing them off here, but I do want to discourage people from writing @trusted code.
If you've identified guidelines for using @trusted it could be really useful to put it in some text form. :)
|
June 29, 2019 Re: Cushion the state transition table library released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atila Neves | On 28.06.19 16:18, Atila Neves wrote: > Would you consider writing a blog post about it? I'm sure it would be helpful to a lot of people. I wrote a little something up: https://gist.github.com/aG0aep6G/f267e316d1dce2763252d82c1808d53a I'm not sure if it's all that helpful, but I don't think I'm willing to invest considerably more time into improving it further. |
Copyright © 1999-2021 by the D Language Foundation