Re: [elm-discuss] Why `let`?

2017-04-23 Thread Wojciech S. Czarnecki
Dnia 2017-04-23, o godz. 10:34:22 Tom Ayerst napisaƂ(a): > "where" would be nice though... > > foo a b = >x + y > where > x = a > y = b Most people read from top to bottom not otherwise. So let - in gives information in proper order: Let -- using this

Re: [elm-discuss] Why `let`?

2017-04-23 Thread Tom Ayerst
"where" would be nice though... foo a b = x + y where x = a y = b On 23 April 2017 at 10:17, Jan Tojnar wrote: > On Sunday, 23 April 2017 02:23:20 UTC+2, Witold Szczerba wrote: >> >> in real code things are much more complicated and confusing. I have >> looked at

Re: [elm-discuss] Why `let`?

2017-04-23 Thread Jan Tojnar
On Sunday, 23 April 2017 02:23:20 UTC+2, Witold Szczerba wrote: > > in real code things are much more complicated and confusing. I have looked > at the Todo.elm you prepared and (for me) it is much harder to reason about. > I agree, it is especially confusing once we get to *destructing*:

Re: [elm-discuss] Why `let`?

2017-04-22 Thread Witold Szczerba
I would agree with Noah Hall, the let/in keywords make parsing easier. In a simple expression like you provided: a = 5 b = 6 a + b it's all clear, but in real code things are much more complicated and confusing. I have looked at the Todo.elm you prepared and (for me) it is much harder to reason

Re: [elm-discuss] Why `let`?

2017-04-22 Thread Noah Hall
Two notes: Let bindings do not have order. Using them in the way suggested implies order. In this world, they would have to be ordered or confusion would reign. This is more imperative style. I've actually really disliked this in CoffeeScript/Ruby, that implicitly the last item in the block is

[elm-discuss] Why `let`?

2017-04-22 Thread Akio Burns
It's not clear to me why Elm uses `let`, instead of simply scoping definitions to the expression below them. With `let`: foo = let a = 1 b = 2 in a + b Scoping definitions to the expression below them: foo = a = 1 b = 2 a + b I understand that