This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parent = self() | |
spawn(fn -> | |
try do | |
<do something nasty> | |
rescue | |
e -> send(parent, {:exception, e}) | |
end | |
end) | |
receive do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(erl). | |
-export([start/0]). | |
-define(Dict, 'Elixir.Dict'). | |
-define(HashDict, 'Elixir.HashDict'). | |
start() -> | |
D = ?HashDict:new(), | |
D2 = ?Dict:put(D, hello, world), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) test simple layering (WyvernTest.Layers) | |
** (ArgumentError) argument error | |
stacktrace: | |
(stdlib) :unicode.characters_to_binary([content: "3", model: []]) | |
(elixir) lib/string.ex:1261: String.from_char_data!/1 | |
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6 | |
(stdlib) eval_bits.erl:80: :eval_bits.eval_field/3 | |
(stdlib) eval_bits.erl:64: :eval_bits.expr_grp/4 | |
(stdlib) erl_eval.erl:477: :erl_eval.expr/5 | |
(elixir) src/elixir.erl:157: :elixir.erl_eval/2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
λ mix test | |
.......... | |
1) test simple layering (WyvernTest.Layers) | |
** (ArgumentError) argument error | |
stacktrace: | |
(stdlib) :unicode.characters_to_binary([content: "3", model: []]) | |
(elixir) lib/string.ex:1261: String.from_char_data!/1 | |
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6 | |
(stdlib) eval_bits.erl:80: :eval_bits.eval_field/3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** (Protocol.UndefinedError) protocol String.Chars not implemented for {:<>, [context: Wyvern.SuperSmartEngine, import: Kernel, line: 1], ["", "\n <style id=\"playLayoutStyle\"></style>\n"]} | |
(elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1 | |
(elixir) lib/string/chars.ex:17: String.Chars.to_string/1 | |
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6 | |
(stdlib) eval_bits.erl:80: :eval_bits.eval_field/3 | |
(stdlib) eval_bits.erl:64: :eval_bits.expr_grp/4 | |
(stdlib) erl_eval.erl:477: :erl_eval.expr/5 | |
(stdlib) eval_bits.erl:80: :eval_bits.eval_field/3 | |
(stdlib) eval_bits.erl:64: :eval_bits.expr_grp/4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Memcachedx.Packet.Parser do | |
@doc """ | |
Parses the response to find the status code and return a friendly message | |
based on it. | |
""" | |
# Those seem to be unused | |
#alias Memcachedx.Packet.Response.Header, as: Header | |
#alias Memcachedx.Packet.Response.Body, as: Body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule View do | |
defrecord Page, [templates: []] | |
defmacro __using__(_) do | |
template = """ | |
<%= for template <- page.templates do %> | |
<%= template.id %> :: | |
<% end %> | |
<%= if true do %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule M do | |
defmacro common_fields(extra \\ []) do | |
[color: nil, id: nil] ++ extra | |
end | |
end | |
defmodule Pawn do | |
import M | |
defstruct common_fields | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MacroM do | |
defmacro h_transform(mod) do | |
IO.puts "Applying h_transform" | |
IO.inspect(mod) | |
end | |
defmacro la_transform(mod) do | |
IO.puts "Applying la_transform" | |
IO.inspect(mod) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Ex do | |
def extract(file) do | |
str = File.read!(file) |> String.to_char_list! | |
all_toks = scan_string(str, 0, []) | |
# now we have all the tokens, we just need to match each one and see if | |
# it's a -define() form | |
all_toks | |
end |