Skip to content

Instantly share code, notes, and snippets.

@beho
Last active December 12, 2015 07:08
Show Gist options
  • Save beho/4734005 to your computer and use it in GitHub Desktop.
Save beho/4734005 to your computer and use it in GitHub Desktop.
Record attribute default value by function call
# compilation fails (function blank/0 undefined)
defmodule RDF do
defmodule Util do
def blank do
"_:1"
end
end
def blank do
"_:1"
end
defrecord Triple, subject: blank #, predicate: blank, object: blank
end
# all good
defmodule RDF do
defmodule Util do
def blank do
"_:1"
end
end
def blank do
"_:1"
end
defrecord Triple, subject: Util.blank #, predicate: blank, object: blank
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment