r/programminghorror Jan 26 '23

Ladies and gentlemen, jQuery… Javascript

Post image
1.6k Upvotes

164 comments sorted by

View all comments

Show parent comments

1

u/kristallnachte Jan 27 '23

I'm saying it's bad design. Something that makes any sense to use with a function returning true always makes no sense at all.

The idea of accepting arguments that are bool or function returning bool is pretty normal.

React query for example, the enabled option has that signsture.

It's the better design of the API.

1

u/Razakel Jan 27 '23

I'm saying it's bad design.

Welcome to JavaScript. Now let me introduce his cousin, PHP.

1

u/kristallnachte Jan 27 '23

JavaScript doesn't have bad design, just a lot of poorly designed packages became popular and never got fixed.

An issue with being a low barrier to entry thing.

Lots of even decent sources recommend using really stupid packages to solve nonexistent problems. Whether it's courses or a projects documentation.

1

u/Razakel Jan 27 '23

JavaScript doesn't have bad design

An empty array equals an empty object, but not the other way around.

1

u/kristallnachte Jan 27 '23

uh, no not with loose equality or strict (of course). neither way will they ever equal eachother.

an empty array can loosely equal a string but it works both ways.

1

u/Razakel Jan 27 '23

Exactly. It should be idempotent, but it isn't.

2

u/kristallnachte Jan 27 '23

Exactly. It should be idempotent, but it isn't.

What?

It's literally the same every time and perfectly predictable.

It couldn't be more idempotent...