Enhancements - #9
Conversation
c3dcaa0 to
1e85c26
Compare
@doc is an Elixir reserved attribute which emits a warning when defined multiple time for a function, Like so: warning: redefining @doc attribute previously set at line 20. Please remove the duplicate docs. If instead you want to override a previously defined @doc, attach the @doc attribute to a function head (the function signature not followed by any do-block). For example: @doc """ new docs """ def on(...) │ 25 │ @doc "..." │ ~~~~~~~~~~~ │ └─ test/fsm/light.ex:25: ExFSM.Test.FSM.Light.on/2 Using @transition_doc and @bypass_doc fixes this issue. It also fixes the value returned by `docs/0` as the @doc attribute comes as a tuple `{line, doc}` instead of the wanted value `doc`.
| fsm = Macro.escape(Module.get_attribute(env.module, fsm_attribute_name())) | ||
|
|
||
| quote do | ||
| def fsm, do: @fsm | ||
| def fsm, do: unquote(fsm) |
There was a problem hiding this comment.
On a @fsm un peu partout, sauf ici, c'est voulu ?
| state_pad = rows |> Enum.map(&String.length(elem(&1, 0))) |> Enum.max() | ||
| event_pad = rows |> Enum.map(&String.length(elem(&1, 1))) |> Enum.max() |
There was a problem hiding this comment.
| state_pad = rows |> Enum.map(&String.length(elem(&1, 0))) |> Enum.max() | |
| event_pad = rows |> Enum.map(&String.length(elem(&1, 1))) |> Enum.max() | |
| state_pad = Enum.max_by(rows, &String.length(elem(&1, 0))) | |
| event_pad = Enum.max_by(rows, &String.length(elem(&1, 1))) |
There was a problem hiding this comment.
No can do as this function is not yet available in Elixir 1.12 and it needs to work with this version based on the contribution guide
EDIT: I was thinking of Enum.sum_by my bad, max_by was introduced way earlier, will change this.
| defp attribute_description_line, do: :"#{attribute_name()}_line" | ||
| defp fsm_attribute_name, do: :fsm | ||
|
|
||
| defmacro __build_action_name_macros__(env) do |
There was a problem hiding this comment.
Je sais pas si on veut vraiment les appeler actions vu qu'en jargon FSM c'est de l'output à executer
| A sigil to enumerate transitions. | ||
|
|
||
| When an FSM grows, it helps to quickly get an overview of the available | ||
| transition. This sigil's purpose is only for documentation purpose: |
There was a problem hiding this comment.
| transition. This sigil's purpose is only for documentation purpose: | |
| transition. This sigil's purpose is only for documentation: |
or something
| end | ||
| end | ||
|
|
||
| defp format_transitions(transitions) do |
There was a problem hiding this comment.
C'est quoi qui fait qu'on ne peut pas réutiliser ce qu'il y a dans le module du formatter ? ou vice-versa
There was a problem hiding this comment.
C'est à dire quelle module?
|
|
||
| - define FSM with handler modules defining each transition as a simple function but using a | ||
| ```elixir | ||
| defmodule Ligh do |
There was a problem hiding this comment.
| defmodule Ligh do | |
| defmodule Light do |
Changes from 7d60cd3 are a proposition. The best option might be to remove the functions
ExFSM.Machine.infos/2,ExFSM.Machine.find_info/2, and thedocs/0function created in the handler module by theExFSM.__before_compile__/1macros. The value returned by doc contains the tuple{line, doc}returned by the@docattribute, however it should only be astringas this doctest shows us. Since no one opened an issue, I think it is safe to remove this unused feature.