Also, the `<-` is the “capturing” match that goes to `else`; `=` is
explicitly permitted for pattern matching invariants (e.g., there is no
meaningful recovery from that failed pattern match).

-a

On Wed, Aug 12, 2020 at 8:49 PM Greg Vaughn <gvau...@gmail.com> wrote:

> Any expression is allowed in the comma-separated steps of a with
> expression. You can put in IO.inspect(myvar) (which I often use for
> debugging purposes). A pattern match (=) is an allowed expression. It is
> not a bug.
>
> -Greg Vaughn
>
> > On Aug 12, 2020, at 7:42 PM, Bruno Rafael <brunorafael6...@gmail.com>
> wrote:
> >
> > Hello all,
> >
> > I mistyped the match operator with an equal signal (=) using the with
> statement and the compiler didn't warn. When calling a function with args
> that don't match the condition of a with statement where the match operator
> is a = the code breaks. I don't know if it's the desired behavior but when
> using the with statement and some condition doesn't match I would expect it
> to go to the else statement. Should the compiler warn in these cases?
> >
> > elixir 1.10.3
> > erlang 22.3.4.1
> >
> > <Screenshot from 2020-08-12 21-40-20.png>
> >
> > Regards,
> > Bruno
> >
> > --
> > 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/ef2b8e67-4fb1-4a7b-a223-bd1fe7ad2336n%40googlegroups.com
> .
> > <Screenshot from 2020-08-12 21-40-20.png>
>
> --
> 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/FB3DF634-6456-412F-A5F5-9E0B28002F08%40gmail.com
> .
>


-- 
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/CAJ4ekQuZgZ0nbU2s56wJWGgnei4BbuajiUXN9dxfv%3D_exbg7zg%40mail.gmail.com.

Reply via email to