Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why GenFsm is deprecated?

Why is the GenFsm behavior of elixir deprecated?

I would like to implement finite state machine with GenFsm behavior. I think Agent is not sufficient to describe finite state machine. Because, Agent is not suitable for describing returning different value each state from same input.

like image 862
tamagohan2 Avatar asked Mar 06 '16 01:03

tamagohan2


3 Answers

See the relevant commit: https://github.com/elixir-lang/elixir/commit/455eb4c4ace81ce60b347558f9419fe3c33d8bf7

Basically, you can now simply use :gen_fsm directly from OTP, without the Elixir wrapper.

like image 110
Patrick Oscity Avatar answered Oct 16 '22 10:10

Patrick Oscity


:gen_fsm also deprecated and replaced in Erlang/OTP 20.0 by :gen_statem so use Generic state machine. For more information check this link about Genstatem

This is a new behavior in Erlang/OTP 19.0. It has been thoroughly reviewed, is stable enough to be used by at least two heavy OTP applications, and is here to stay. Depending on user feedback, we do not expect but can find it necessary to make minor not backward compatible changes into Erlang/OTP 20.0

like image 43
saroj Avatar answered Oct 16 '22 12:10

saroj


The Elixir core team decided that it was too confusing and suggested that developers seek other solutions.

I wrote an Elixir wrapper around it 3 days ago, and pushed it up to hex.pm with the name gen_fsm. Here's the github page: https://github.com/pavlos/gen_fsm if you want to check it out.

like image 39
Pavlos Avatar answered Oct 16 '22 11:10

Pavlos