DEV Community

loading...

Discussion on: Demystifying the Long Arrow "Operator"

Collapse
beernutz profile image
beernutz • Edited

That is just a bad idea.

There really is no such thing as a "Long arrow" operator.

The example of:

while (i --> 0) {
  console.log(pets[i]);
}

Is really just:

while (i-- > 0) {
  console.log(pets[i]);
}

The post decrement does not belong to the greater than sign, and implies entirely different things.

Collapse
somedood profile image
Basti Ortiz (Some Dood) Author

Exactly the point I tried to hit on. I purposefully added quotation marks around the word "operator" every time I used it in the context of the "long arrow operator" because of that.

Collapse
beernutz profile image
beernutz

But that is the problem. There is no such thing as a "long arrow operator", and you are just sowing confusion.

Thread Thread
somedood profile image
Basti Ortiz (Some Dood) Author

I see. I get your point. I wrote this article so that people would be aware of an unorthodox way of formatting their code, so that when they encounter them in the wild, they'd be prepared to tackle them.

Indeed, the entire point of this article is to demystify something that doesn't exist. It's great that you pointed this out, though.

Thread Thread
asparallel profile image
AsParallel

Nah, keep it up. The confusion was sown long before that. I had a good laugh.

Thread Thread
somedood profile image
Basti Ortiz (Some Dood) Author

Oh. Thanks, man. Appreciate it! 👍

Collapse
worc profile image
worc • Edited

but you also called it analogous to a limit function. which is confusing and it's just not. limits in my mind are inclusive, infinite sequences, not integer-based, step-wise functions that forget their initial value.

Thread Thread
somedood profile image
Basti Ortiz (Some Dood) Author

That's true. I do catch your drift. I see where I might have caused some confusion there.

It isn't meant to equate the two ideas, though. One shouldn't get too worked up in it. It is just an analogy after all.

Thread Thread
worc profile image
worc

i think the issue is that it's a bad analogy. it draws parallels where there are none, and it creates a mind map that just doesn't match the terrain.

Thread Thread
somedood profile image
Basti Ortiz (Some Dood) Author

That's true. This isn't the first time I've made bad analogies. Guess I'm still learning how to play with my words in an interesting manner. I'll keep working on it.

Admittedly, though, I don't see the analogy I made as entirely wrong. There is still some truth to it. The notation does imply some sort of "approaching by decrementing" to an extent. Regardless of that, it's still a bad analogy, as you said, and I agree.

However, I won't edit the article because that's really how I thought about the notation at first. It would really be dishonest of me and to myself if I changed the analogy now. So for now, it shall serve as a reminder to me to be better with my analogies.

Thread Thread
worc profile image
worc

The notation does imply some sort of "approaching by decrementing"

i think the issue is that "approaching by decrementing" just isn't a limit. if you'd stumbled across a "approach through an infinite sequence" operation (maybe something that recursively takes smaller steps as it approaches a correct answer?), then i think you'd be on to something.

Thread Thread
somedood profile image
Basti Ortiz (Some Dood) Author

I see. I get your point.