Skip to content

Commit

Permalink
Deprecate GenFSM
Browse files Browse the repository at this point in the history
We plan to provide better abstractions around GenServer and GenEvent
in upcoming releases but we won't do so for GenFSM. There are other
interesting approaches out there, like `plain_fsm`, which are easier
to understand and use than OTP's FSM.
  • Loading branch information
José Valim committed Mar 8, 2014
1 parent a6f048b commit 455eb4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 43 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@

* Deprecations
* [File] `File.stream_to!/3` is deprecated
* [GenFSM] `GenFSM` is deprecated
* [Kernel] `%` for sigils is deprecated in favor of `~`
* [Kernel] `is_range/1` and `is_regex/1` are deprecated in favor of `Range.range?/1` and `Regex.regex?/1`
* [Stream] `Stream.after/1` is deprecated
* [URI] `URI.decode_query/1` is deprecated in favor of `URI.decode_query/2` with explicit dict argument
* [URI] Passing lists as key or values in `URI.encode_query/1` is deprecated

* Backwards incompatible changes
* [Mix] Remove `MIX_GIT_FORCE_HTTPS` as Git itself already provides mechanisms for doing so

# v0.12.4 (2014-02-12)

* Enhancements
Expand Down
2 changes: 2 additions & 0 deletions lib/elixir/lib/gen_fsm/behaviour.ex
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ defmodule GenFSM.Behaviour do
@doc false
defmacro __using__(_) do
quote location: :keep do
IO.puts :stderr, "warning: GenFSM is deprecated and it will be removed in upcoming releases\n#{Exception.format_stacktrace}"

@behaviour :gen_fsm

@doc false
Expand Down
43 changes: 0 additions & 43 deletions lib/elixir/test/elixir/gen_fsm/behaviour_test.exs

This file was deleted.

10 comments on commit 455eb4c

@bagwanpankaj
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@mus0u
Copy link

@mus0u mus0u commented on 455eb4c Mar 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be some other standard elixir FSM wrapper at some point in the future? I was just beginning to use GenFSM when I saw this; the project is not urgent by any means but I will need to do something with it at some point. Not sure if I should wait for another elixir solution like GenFSM or try to learn the stock erlang plain_fsm.

@josevalim
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mus0u you can also use Erlang's :gen_fsm directly, which GenFSM is a simple wrapper for. I don't think we will get an FSM solution before 1.0.

@mus0u
Copy link

@mus0u mus0u commented on 455eb4c Mar 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense. Thank you!

@AndrewDryga
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, is there are any new FSM solutions or maybe we should get back to this? :)

@whatyouhide
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndrewDryga the new kid in town is gen_statem, which was released in Erlang 19. There is no official plan of wrapping this in Elixir as it is straightforward to use the Erlang version directly; if you still want an Elixir way of interacting with it, there's https://github.com/antipax/gen_state_machine as well :)

@fishcakez
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gen_statem is currently experimental so we would require at least OTP-20 before thinking about. The behaviour has incompatible changes between OTP-19.0 and OTP-19.1.

@whatyouhide
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fishcakez that is a good thing to point out, yes.

@edudemy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates of gen_statem included in OTP 22.2 @whatyouhide

@whatyouhide
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edudemy no plans for now, I think the plan is to use gen_statem directly, which works very well anyways :)

Please # to comment.