On Wednesday, 5 October 2016 01:55:40 UTC+1, Max Goldstein wrote:
>
>
>> they start to *resemble *OO/imperitive style variable assignments
>>
>
> But they're not. You can't assign to the same value more than once. You
> can actually have some values before the *in* depend on others, but you
> can't do so circularly-- so subject to those dependencies the values may be
> bound in any order. And doing these assignments can only affect anything
> else through how the in-expression is used; they don't attach to an object
> or contaminate global scope.
>
> Chaining is great when you want to apply many transformations in sequence.
> Let-bindings are parallel. If it makes sense to have reusable, atomic
> update functions for your record ("updateVelocity"), go for it. But doing a
> batch update of a record with let-bound values feels more natural.
>
I guess that's the crux of it - I do understand they are not variable
assignments, but with a lot of them, they start to give that appearance,
especially if conceptually unrelated values are being applied to different
fields. So I suppose a better style would be to have only related things
inside the let, i.e only be wary of a large 'let' block if there are a
number of unrelated things in there, but if there is a large number of
related things (a 'batch' as you say) then that's totally fine.
>
>
>> Any strong opinions about this?
>>
>
> We try not to have strong opinions. Write code that is correct, explicit,
> and concise (prioritize in that order). Language features and code style
> are in service to that goal.
>
A noble sentiment and one that I agree with. However, I don't know what it
is about software, but having worked in the industry for years now, I've
probably come across more strong opinions than you've had hot dinners ;)
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.