elixir icon indicating copy to clipboard operation
elixir copied to clipboard

Need easy way to read files with Elixir data structures

Open pminten opened this issue 13 years ago • 3 comments

Elixir currently doesn't have a simple one-function way to read a data structure from a file, making sure it's safe.

If you're new to the project and like to contribute you might want to take a stab at this.

Functions that might be useful useful here: File.read, Code.string_to_quoted, Macro.safe_term and Code.eval_quoted.

pminten avatar Oct 20 '13 10:10 pminten

Hrm, I think it would be better to sway those things through the mailing list first. As you just said, we have the building blocks, so I am not convinced why we need to put them altogether into a single function. Even because some apps may want to have their own safe_term mechanisms, default bindings, default imports. So exposing how it is done is better in this case imo.

josevalim avatar Oct 20 '13 10:10 josevalim

Ok, will play it through the ML next time.

Still think this should be an easy task though, at the very least it should be well documented.

pminten avatar Oct 20 '13 11:10 pminten

Btw, if safe_term is acting weird, we just need to improve it. For example, we should support __block__. :)

josevalim avatar Oct 20 '13 13:10 josevalim