marick
About how Phoenix renders iodata rather than strings
As a new Phoenix user, I was happy to discover that Phoenix doesn’t render strings but something rather like Erlang iodata. That lets me use a more builder-style approach for creating chunks of HTML pages - but without having to use elaborate infrastructure. Seems to be working nicely so far.
In any case, I thought I might write up a blog piece about what I now understand about Phoenix rendering and iodata. As a newbie, I’ve probably gotten things wrong. Corrections welcome here or at http://blog.roundingpegs.com/taking-advantage-of-phoenix-rendering-and-iodata-part-1/
Most Liked
OvermindDL1
Nice, although one thing to note is that although eex accepts ‘nil’, it should not really ever be used. Returning an empty list of [] is always a better approach than returning nil as it then allows it to be embedded further without worry. I consider nil’s returned from a function that could ever possibly end up going to a template as a bug.
Other than that your article looks like a fairly accurate high level view. 
michalmuskala
I honestly don’t think this is a good idea. Erlang uses nil to mean empty list only because that’s the naming in lisp. But I don’t think there’s a strong technical reason for it.
Erlang itself most often uses the atom undefined for uninitialised state, so I think using an atom for this purpose in elixir makes the most sense.
josevalim
[] is not Erlang’s nil. That notation is used only in the abstract syntax tree and in Erlang code nil has exactly the same as nil in Elixir.
Plus [] has the notion of cardinality, which nil is devoid of. Given Elixir has both collections and base types, I believe it is important to represent nothingness without a notion of cardinality built-in.







