Record creation shortcut

Wouldn’t something like this be de-structuring without assignment?:

case list of
    ["hello"] -> ...

Surely this:

const foo = ({a, b}) => a + b

counts as assignment as a and b are being assigned in the function body. Regardless, I think we understand each other.

Thanks to everyone that’s contributed so far, it’s interesting to get other perspectives on this and it’s clear that it’s a lot more contentious than I initially thought it would be!

1 Like

Sorry that I dodn’t answer to everything. As you say, the topic is not trivial, I want to clarify more the context of my statement. In this example:

only the third case is introducing a new value. In the two first cases the value is defined somewhere else. I was thinking more about answering to questions like “where is this value set/calculated”? But you are right, it is not a golden rule, but it helps a lot having a uniform language.

Having a uniform language is a super hard to beat argument. I have read a lot of code in the last 30 years. When languages are very flexible projects easily ends up becoming DSL. On the other hand, if the language is super uniform, it is closer to behaving as a Framework, where all projects tend to use the same structure and patterns. I think that Elm fits much better this second case, and that is one of its strengths.

But, again, these are my thoughts. Regards!


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.