Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Mix in functions from other modules

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 include
Octocat-spinner-32 src
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.markdown
Octocat-spinner-32 rebar
Octocat-spinner-32 rebar.config
README.markdown

foo.erl:

-module(foo).

-export([doit/0, doit/1, doit/2]).

doit() ->
    doit.

doit(A) ->
    [doit, A].

doit(A, B) ->
    [doit, A, B].

Module bar.erl which 'mixes in' foo:

-module(bar).
-include_lib("mixer/include/mixer.hrl").
-mixin([foo]).

or only specific functions from foo:

-module(bar).
-include_lib("mixer/include/mixer.hrl").
-mixin([{foo, [doit/0, doit/2]}]).

Another version of bar.erl which mixes in all functions from foo and select functions from baz:

-module(bar).
-include_lib("mixer/include/mixer.hrl").
-mixin([foo, {baz, [doit/0, doit/1]}]).

One more version of bar.erl which mixes in foo:doit/0 and renames it to do_it_now/0:

-module(bar).
-include_lib("mixer/include/mixer.hrl").
-mixin([{foo, doit/0, do_it_now}]).

The original motivation for this parse transform was to permit reuse of functions implementing common logic for tasks such as signature verification and authorization across multiple webmachine resources.

Something went wrong with that request. Please try again.