Gleam: Discarded variables don't increment in ouputed erlang

Created on 11 Sep 2020  Â·  6Comments  Â·  Source: gleam-lang/gleam

let _r = 1
let _r = 2

This code runs with this failure.

** (MatchError) no match of right hand side value: 1

I think it's making erlang code that looks like the following.

_R = 1
_R = 2
bug good first issue help wanted

Most helpful comment

Yes that would do it!

On Wed, 30 Sep 2020, 12:13 Santi Lertsumran, notifications@github.com
wrote:

@lpil https://github.com/lpil for "or we could make it so discard
patterns always render _, discarding the name."

Do you mean replace this line

[image: Screen Shot 2563-09-30 at 18 10 32]
https://user-images.githubusercontent.com/11692854/94678273-6875a080-0348-11eb-8b8d-f39e9f3385ca.png

to

[image: Screen Shot 2563-09-30 at 18 10 19]
https://user-images.githubusercontent.com/11692854/94678300-74616280-0348-11eb-8892-eed899d6c58a.png

right?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gleam-lang/gleam/issues/788#issuecomment-701324265,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABOZVBWZDW5R3IPJD4JDDHTSIMHD5ANCNFSM4RHYBUDQ
.

All 6 comments

Oops, thank you!

@lpil I try to fix this issue. I found Erlang code looks like in picture
Screen Shot 2563-09-25 at 17 12 57
Screen Shot 2563-09-25 at 17 13 03

and I debug in local_var_name function. I never seen _r pass to this function
Screen Shot 2563-09-25 at 17 13 20

Can you have suggest me?

Hello, thank you for helping out with this.

That code does not currently get called for discard patterns, which is why this bug is occurring.

To me it seems there are two options. We could either update the code to use the code you linked when rendering discount patterns, or we could make it so discard patterns always render _, discarding the name. I would be happy with either, and the latter would be easier to implement.

Does that help?

Thank you very much. Let me try.

@lpil for "or we could make it so discard patterns always render _, discarding the name."

Do you mean replace this line

Screen Shot 2563-09-30 at 18 10 32

to

Screen Shot 2563-09-30 at 18 10 19

right?

Yes that would do it!

On Wed, 30 Sep 2020, 12:13 Santi Lertsumran, notifications@github.com
wrote:

@lpil https://github.com/lpil for "or we could make it so discard
patterns always render _, discarding the name."

Do you mean replace this line

[image: Screen Shot 2563-09-30 at 18 10 32]
https://user-images.githubusercontent.com/11692854/94678273-6875a080-0348-11eb-8b8d-f39e9f3385ca.png

to

[image: Screen Shot 2563-09-30 at 18 10 19]
https://user-images.githubusercontent.com/11692854/94678300-74616280-0348-11eb-8892-eed899d6c58a.png

right?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gleam-lang/gleam/issues/788#issuecomment-701324265,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABOZVBWZDW5R3IPJD4JDDHTSIMHD5ANCNFSM4RHYBUDQ
.

Was this page helpful?
0 / 5 - 0 ratings