That makes sense. Maybe the compiler can detect cases like this:

```eex
<% variable = 'boo' %> <!-- OK -->
<% if @bar do %> <!-- Warning or error, because of the block? -->
```

-a

On Fri, Dec 4, 2020 at 12:50 PM Jim Freeze <[email protected]> wrote:

> Yes, those bugs are annoying, but I commonly start *.html.leex docs with
>
> <% somevar = "blah" %>
> ...
> <div class="<%= somevar %>"> ...
>
> Jim
>
> On Fri, Dec 4, 2020 at 11:46 AM Austin Ziegler <[email protected]>
> 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 • [email protected][email protected]
>> 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 [email protected].
>> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/CAP1mN_z8BbAniw9k5Ee_axR-JZGvzC02Z2CoqKDs3CyMZPAA-Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAP1mN_z8BbAniw9k5Ee_axR-JZGvzC02Z2CoqKDs3CyMZPAA-Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Austin Ziegler • [email protected][email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAJ4ekQt_A23zpN0wROQZTKGPd4xzXCBL-LtqjGUv%3D3%2Bo40190Q%40mail.gmail.com.

Reply via email to