Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> addition in plain English is always commutative

But that is manifestly untrue. Ask a native English speaker what "ABC" plus "DEF" is and they will almost certainly respond "ABCDEF". Ask them what "ABC" times "DEF" is and they will almost certainly respond with something analogous to to WTF?



Make those two words mean something instead of literally giving them strings, and see what they tell you. Ask them if two apples and an orange are the same thing as two oranges and an apple. Put literally any objects and ask them if the sums is the same. I guarantee you far greater than 50% of the things you come up with will result in "same" as the answer.

But regardless: I don't know why you're arguing with me back and forth like this. It's not like I set the convention. I didn't design your favorite programming language. I didn't even claim there are zero reasons to denote concatenation with addition in programming. (!) I was just trying to help you understand something I thought you genuinely had a question about: some reasons in favor of using multiplication that make sense, notwithstanding any reasons arguing for the opposite position. And like I told you in the beginning, this isn't absolute, you can quite literally find counterexamples even in math if you go Googling. But your goal was clearly something else entirely, so don't expect me to have anything else to add (whether commutatively or otherwise).


> I don't know why you're arguing with me back and forth like this.

I am trying to understand if the claim you are defending:

> concatenation is a natural product, not a sum

has any merit. I'm "arguing" to see if you have any rebuttals to my objections to your reasoning before I conclude that no, it doesn't.

Going back over this thread I am puzzled by one thing: that original claim was not yours, it was from /u/naniwaduni. You opened with "string + string". Why are you now so vehemently defending "string * string"?

Oh, and just for the record:

> Make those two words mean something instead of literally giving them strings, and see what they tell you.

Well, yeah, of course. Addition applied to fruit is a different operation than addition applied to strings. So?


Here is an interesting discussion from the julia language where string concatenation is indeed the * operator:

https://github.com/JuliaLang/julia/issues/1771

In particular:

https://github.com/JuliaLang/julia/issues/1771#issuecomment-...

Undoubtedly, it is a big surprise for new users (without exposure to free monoids :-)), that * is string concatenation.

By the way, in python juxtaposition ("abc" "def") is also valid.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: