react

Aron 2022-01-13T12:35:48.000600Z

such an interestingly frustrating read, i must share https://americanexpress.io/faccs-are-an-antipattern/

Aron 2022-01-28T08:01:35.062119Z

+ is not the thing here

Aron 2022-01-28T08:01:38.899459Z

😄

Aron 2022-01-28T08:01:57.471819Z

the specific configuration of symbols is

Aron 2022-01-28T08:02:44.581189Z

But yeah, I have to say, I also got frustrated even with that, since 'add' and 'sum' are entirely different mathematical concepts and thus different functions

Aron 2022-01-28T08:03:32.136599Z

but the more frustrating part for me was that they identify a problem and then bring a worse solution on it 😄

Drew Verlee 2022-01-28T21:31:18.583199Z

> + is not the thing here @ashnur what do you mean?

Aron 2022-01-28T23:06:27.032619Z

I mean, the author is attempting to make an argument about fitting names and compares add with badger and tapioca and children. It's clearly a bad argument, since children is part of the React API. So I am not trying to defend it. That said, I think because + operator can be imagined as a function (or even have a language where it actually is a function that does exactly what they say the new function would do) doesn't mean that the author is talking about the same function. I can do this little bit of steelmanning their argument so that I can focus on the much bigger inaccuracies in the article.

Aron 2022-01-28T23:07:19.735249Z

And I wouldn't even care about it, if I wouldn't agree with the premise.

Drew Verlee 2022-01-28T02:46:02.362229Z

> I still maintain that the practice of naming things matters. > Let’s say that you had a function that took two numbers, added them together and returned the result. What would you call that function? You might call it add, or maybe sum.

const add = (a, b) => {
  return a + b;
};

add(2, 2);
Yea. don't do that. dont make that function, it already exists. The author is lamenting that things don't have good names and then he introduces a function with a terrible name. that function he wrote isn't "add" it's "add-only-two-things" (+ a b) isnt' unnamed, the code is the name, and it's a better name because it's as true to me as it is to the compiler.

Aron 2022-01-28T03:50:02.547409Z

But it's not (+ a b), it's (a, b) => a + b

Aron 2022-01-28T03:51:46.327469Z

It would be (fn [a b] (+ a b))

Aron 2022-01-28T03:51:48.872999Z

it is unnamed

Drew Verlee 2022-01-28T04:04:15.451659Z

+ is a name

Drew Verlee 2022-01-28T04:04:52.445989Z

and its so amazing we reduced it to two lines and one character.

Drew Verlee 2022-01-28T04:09:51.247329Z

But i take your point, if you had to pass that function in clojre you would write #(+ %1 %2)

Drew Verlee 2022-01-28T04:11:19.485829Z

but you could just pass (apply + <some collection) though apprently thats slower then (reduce + <some collection>) in some cases i cant remember.

Aron 2022-01-13T12:36:11.001100Z

I agree with the premise, but not with the suggested alternative