[erlang-questions] pushing a dict in the constant pool
Anthony Molinaro
anthonym@REDACTED
Mon Jan 24 19:10:50 CET 2011
You could use ct_expand in the parse_trans package
https://github.com/esl/parse_trans
and have something like
get_my_dict () ->
ct_expand:term (
dict:from_list ([{foo, bar}, {baz, bop}])
).
Then your dictionary gets expanded at compile time. This is assuming
you can define the dictionary at compile time.
-Anthony
On Mon, Jan 24, 2011 at 06:43:22PM +0100, Paolo Negri wrote:
> Dear list,
>
> I would like to know if there's a way to get a dict to be stored in
> the constant pool
>
> For a list I would do
>
> get_useful_list() ->
> [my, useful, ubiquitous, list]
> .
>
> But if I would like to have a similar function to get a dict (with up
> to few hundreds entries), how would it look like?
> My reason to look into this is in order to be able to efficiently
> distribute constant and immutable configuration data to thousands of
> processes and provide constant time lookup.
>
> Thanks for your help.
>
> Paolo
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
--
------------------------------------------------------------------------
Anthony Molinaro <anthonym@REDACTED>
More information about the erlang-questions
mailing list