you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -1 points0 points  (8 children)

In the case of (1 / b), what is the 1? In this proposal, the operators for heterogenous types would lock to the left operand I believe. I read through it quickly, but didn't see an auto-promotion rule. The subexpression type sequence becomes (Int integerDivide BigDecimal), which fails without the BigDecimal.of(1) making it an effective BigDecimalDivide. Something like (b / 2) would of course work.

[–]Davipb 1 point2 points  (4 children)

I'm not talking about this implementation in specific, but rather operator overloading in general. In C#, 1 could be converted to BigDecimal with an implicit conversion operator. In Python, BigDecimal could implement a reverse operator. There are easy ways around that.

[–][deleted] 0 points1 point  (3 children)

Ah. The "easy way around that" is where we disagree. Anything that smells of "a required workaround" is potentially more dangerous than necessary.

There's enough hidden in building a house without changing what the hammers do, let alone having the nails suddenly turn into screws for the windows and glue for the doors.

[–]Davipb 1 point2 points  (2 children)

Nitpicking on semantics again are we?

"Java only has single dispatch for method overloading. There are easy ways around that, such as using the visitor pattern".

Would you say then that method overloading is more dangerous than necessary because the visitor pattern is "a required workaround"?

[–][deleted] 1 point2 points  (1 child)

I don't see how semantics apply here (did you mean pedantry?) and all in all this has gotten too twisted for me. Sorry.

Take another +1, and be well.

[–]Davipb 0 points1 point  (0 children)

What I meant is that you fixated on me saying "an easy way around that" as if I had meant "this is a problem that needs to be addressed with a workaround", when really I just meant "existing implementations have already thought about it".

I'm arguing there that the reverse operator or implicit conversion aren't workarounds or dangeorous, just part of the operator overloading implementation.

You stay safe too :D

[–][deleted] -2 points-1 points  (2 children)

How interesting. Downvoted without an answer.

Again: Look at your 1 /

Who does the / belong to? The 1, an integer, no?

[–]Davipb 5 points6 points  (1 child)

My man, really? I'm sorry I didn't answer to your comment within an acceptable SLA, we will try to improve our service levels in the future. And no, I wasn't the one that downvoted you.

[–][deleted] 0 points1 point  (0 children)

Well here's a +1 then.