Skip to content

Instantly share code, notes, and snippets.

@ztmr
Created October 27, 2014 12:20
Show Gist options
  • Save ztmr/e31d5cbce861f2cc7138 to your computer and use it in GitHub Desktop.
Save ztmr/e31d5cbce861f2cc7138 to your computer and use it in GitHub Desktop.
LFE on_load attribute
The following works well:
(defmodule dws_lisp_service
(export (version 1)
(do-eval 4))
(on_load #(autoregister 0)))
...unlike the following:
(defmodule dws_lisp_service
(export (version 1)
(do-eval 4))
(on_load (tuple autoregister 0)))
...what ends up with a compiler error:
src/dws_lisp_service.lfe:none: internal error in beam_asm;
crash reason: {case_clause,[[tuple,autoregister,0]]}
in function beam_asm:on_load/2 (beam_asm.erl, line 41)
in call from beam_asm:assemble/4 (beam_asm.erl, line 36)
in call from beam_asm:module/4 (beam_asm.erl, line 30)
in call from compile:beam_asm/1 (compile.erl, line 1320)
in call from compile:'-internal_comp/4-anonymous-1-'/2 (compile.erl, line 292)
in call from compile:fold_comp/3 (compile.erl, line 310)
in call from compile:internal_comp/4 (compile.erl, line 294)
in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line 153)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment