New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern Matching for tuples in `let` isn't work as expected #740

Closed
astynax opened this Issue Oct 27, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@astynax

astynax commented Oct 27, 2016

Hello!
This code works fine (in elm-0.17.1):

import Html exposing (text)

main =
  let
    b = a / 2
    a = 4  -- declarations are in mixed order, but it's fine!
  in text <| toString (a, b)

-- Output:
-- (4, 2)

but this one isn't

main =
  let
    (a, b) = (4, a / 2)
  in text <| toString (a, b)

-- Output:
-- (4, NaN)

There is no warning / compilation errors. And I think what this binding is legal as legal the former one.

Here is an example with strings:

main =
  let (a, b) = ("hello", String.append a " world!")
  in text <| toString (a, b)

-- Output:
-- ("hello", "undefined world!")
@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Oct 27, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Oct 27, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@astynax

This comment has been minimized.

Show comment
Hide comment
@astynax

astynax Oct 27, 2016

  • Browser: Firefox 49.0
  • OS: Ubuntu 16.04.1 LTS
  • Elm version: 0.17.1 (installed from npm)

astynax commented Oct 27, 2016

  • Browser: Firefox 49.0
  • OS: Ubuntu 16.04.1 LTS
  • Elm version: 0.17.1 (installed from npm)
@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Oct 27, 2016

Member

This is a duplicate of elm/compiler#873 which will be fixed in 0.18.

Member

evancz commented Oct 27, 2016

This is a duplicate of elm/compiler#873 which will be fixed in 0.18.

@evancz evancz closed this Oct 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment