Hello everybody,

Today the hat/pin operator (^) only allows the variable as argument, but I 
think it would be completely valid for it to allow any expression. This feels 
like a natural extension, especially useful when dealing with map fields. The 
number of times I tried to write something like that, only to realise it will 
fail is "too damn high" :P

    assert_received {:foo, ^map.foo}

The obvious fix is to transform this into

    foo = map.foo
    assert_received {:foo, ^foo}

But I wonder - couldn't this be done automatically by the compiler, to extract 
such things from the patterns in order to place them before the case 
expression? I could be missing something, especially around some semantic 
difference, but I though about this for some time, and couldn't see anything 
harmful.

Michał.

-- 
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/6B434A06-5482-4CB8-BB76-18403C89DA7F%40muskala.eu.
For more options, visit https://groups.google.com/d/optout.

Reply via email to