If I wanted to find every usage of `MyType#equals` in my codebase (because I want to replace it with `Eq`) what would be a good way to do that?
-
-
Replying to @propensive
Can a macro find Eq a implicitly and replace codegen of == for it or default to equals when not found? Same for Order and other operators like >, <, ...?
1 reply 0 retweets 1 like -
Replying to @raulraja
Would that be an annotation macro? I think it probably could... Alternatively, a compiler plugin could do it. Order operators are a bit easier, because they're not on every single object, and the types they do exist for usually have the implementation you always want...
1 reply 0 retweets 1 like -
Replying to @propensive
Yeah I was thinking that a mode for most FP programs would be that if you provide or auto derive a cannonical Eq, Order, Semigroup, etc then the use of the type class won't require different syntax from what people already now since those are the lang operators already.
2 replies 0 retweets 1 like -
Replying to @raulraja
That's a good point. I don't want to have to remember to write `===` (or something similar). But I think I'd still need to remember the macro annotation everywhere. A compiler plugin could avoid that, though. (At which point, I begin to lose some interest... ;) )
1 reply 0 retweets 1 like -
Replying to @propensive @raulraja
A compiler plugin would be pretty cool. Why would you lose interest?
1 reply 0 retweets 0 likes
Just that it's a bit more effort to get it working, and it makes it a bit harder for anyone else to use. Just more friction... and Scala 3 offers a more principled solution anyway, so it slowly works its way beneath my other priorities... ;)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.