That's a good point. I suspect the convention around manual usage would 
converge around:

*def foo(%{x: x} = result when x > 1), do: 1*

which parses as expected. This version feels more natural to me.

I don't think the other form would accidentally be introduced while 
injecting one snippet of AST, because the tree would never be constructed 
the wrong way. String-based expression interpolation might make that 
mistake, but if you're metaprogramming with literal strings of code you've 
already made a mistake.

I hadn't typed out an assignment case with inline guards, it does feel like 
it's doing too much in a short space with few grammar tokens to help 
understand it. That's a good argument for intentionally discouraging these 
constructs outside of metaprogramming, rather than adopting it as a common 
usage language feature.

-- 
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/f2fafacb-3302-4c03-9b1b-ed766a896cc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to