www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Cushion the state transition table library released

reply SHOO <zan77137 nifty.com> writes:
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
Jun 26 2019
parent reply ag0aep6g <anonymous example.com> writes:
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.
Jun 26 2019
next sibling parent reply SHOO <zan77137 nifty.com> writes:
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
Jun 27 2019
parent Digital Mars <drug2004 bk.ru> writes:
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.
Jun 27 2019
prev sibling parent reply aliak <something something.com> writes:
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 ;)
Jun 27 2019
parent reply ag0aep6g <anonymous example.com> writes:
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.
Jun 27 2019
next sibling parent reply Atila Neves <atila.neves gmail.com> writes:
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.
Jun 28 2019
parent ag0aep6g <anonymous example.com> writes:
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.
Jun 29 2019
prev sibling parent Guillaume Piolat <first.last gmail.com> writes:
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. :)
Jun 28 2019