Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many warnings when compiling with elixir 1.3 #21

Closed
jeanparpaillon opened this issue Oct 6, 2016 · 2 comments
Closed

Many warnings when compiling with elixir 1.3 #21

jeanparpaillon opened this issue Oct 6, 2016 · 2 comments

Comments

@jeanparpaillon
Copy link
Contributor

elixir 1.3 deprecates some languages features used in ewebmachine, producing a lot of warnings

@jeanparpaillon
Copy link
Contributor Author

jeanparpaillon commented Oct 12, 2016

Most of ewebmachine macros use the (anti-hygienic) var! construction in macros for producing side-effects (ie affect context's conn and user_state variables).

  • PRO: side effect provided through syntaxic sugar, no runtime override
  • CON: if used inside a if/cond/... construction, implies unsafe use of variables, which is deprecated

Alternatives are:

  1. no side-effect: all functions takes explicitly conn and user_state variables and returns a
    copy of them:

    • PRO: no side effect
    • CON: heavier syntax, big API change
  2. no side effect, with simplified callbacks: all callbacks have a simplified version macro, without
    conn and user_state variable available

    • PRO: no side effect, clean syntax
    • CON: (limited) API change: when using simplified macros, conn and state are not available anymore
    is_conflict(conn, state) -> {boolean(), conn, state}
    is_conflict -> boolean()
  3. side effect through process dictionary: original webmachine implementation

    • PRO: light syntax
    • CON: performance
  4. side effect through external process:

    • each request processing process (P1) is attached another process (Agent ?, ets table ?, P2) storing conn and user_state
    • P1 process dictionary stores only P2 pid
    • PRO: no API change, clean syntax
    • CON: performance between 1-2 and 3 ?

@jeanparpaillon
Copy link
Contributor Author

Fixed in 7dc4157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant