Not discounting, just trying to understand. You’re saying you have
something like:

```eex
<% for dir <- directories do %>
<%   for file <- File.ls(dir) do %>
{ "file": <%= file %> }
<% end %>
<% end %>
```

Based on what I’ve seen, that JSON bit won’t generate because neither of
the for loops uses `<%=`.

Or are you doing something more like Jim’s case where you’re using a for
loop to configure a local variable and then using `<%=` forms to generate?

I’m perfectly willing to be wrong in this case, but ultimately this feels
like something that the compiler should be able to detect some cases like
this, as the documentation calls this out explicitly (
https://hexdocs.pm/eex/EEx.html#module-tags; see the paragraph about `if`
statements).

If I’m wrong, then I withdraw the request. I’m just annoyed that I was
bitten by this for two months and the ease with which I missed it every
time I looked at the code.

-a

On Fri, Dec 4, 2020 at 12:55 PM Floating Front <floatingfr...@gmail.com>
wrote:

> Apologies to chip in here, I am certainly no expert in this area, but I
> think your assumption about “no case where a starting EEx block…” - I have
> used it in generating json from directory traversal, and would not get away
> without it…
> just my five pennies…
> R.
> Fridrik.
>
>
> On 4 Dec 2020, at 17:46, Austin Ziegler <halosta...@gmail.com> wrote:
>
> I’ve had a bug in my code for the last couple of months caused by the fact
> that EEx isn’t ERB. Specifically, I had code that looked like:
>
> ```eex
> <% if @password %>
> Temporary Password: <%= @password %>
> <% else %>
> Sign in with your existing password.
> <% end %>
> ```
>
> Looking at it in isolation, it’s really obvious that the first line should
> have been `<%= if @password %>`, but in situ…I’ve gotten multiple bug
> reports on this but have never been able to see what the problem was until
> today.
>
> Is it possible to modify the EEx compile phase so that code like I wrote
> above generates at least a warning? As I understand it, there’s no case
> where a starting EEx block will usefully begin with `<%` instead of `<%=`.
>
> -a
> --
> Austin Ziegler • halosta...@gmail.com • aus...@halostatue.ca
> http://www.halostatue.ca/http://twitter.com/halostatue
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/CAJ4ekQs2G4HUX_y8q-UqYyTY4z5nX6JMOKdMb%3DcZSZwgpDxk0Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAJ4ekQs2G4HUX_y8q-UqYyTY4z5nX6JMOKdMb%3DcZSZwgpDxk0Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/04543F62-E3F5-4664-A9CC-2701CEA7427A%40gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/04543F62-E3F5-4664-A9CC-2701CEA7427A%40gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Austin Ziegler • halosta...@gmail.com • aus...@halostatue.ca
http://www.halostatue.ca/http://twitter.com/halostatue

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAJ4ekQsFa48p_X_7y5r-nbg26yV-dBBrCfWciTfgd92OKK%2Bj7w%40mail.gmail.com.

Reply via email to