4 ms·
It doesn't matter which operator you choose as an example. It's the same with a == b. And I don't agree that it's a theoretical problem that only arises with b
by xjru 14y ago
It doesn't matter which operator you choose as an example. It's the same with a == b.
And I don't agree that it's a theoretical problem that only arises with bad code. It's simply a downside that we have to be aware of when we use DSLs, even well designed ones. For some purposes bland code is just better than smart code.
But I do agree that a Scala based DSL is hugely superior compared to any byte code manipulation based Java framework that obscures lanaguage semantics beyond recognition. It's also way easier to reason about Scala code than about Python/Ruby style meta programming.
- happy_dino 14y agoIt's funny that you keep picking blatantly wrong examples. scala> def ==(a: Any) = false <console>:7: error: overriding method == in class Any of type (x$1: Any)Boolean; method == cannot override final member def ==(a: Any) = false ^ Maybe you should actually use the language for a few minutes before commenting? :-)
- xjru 14y agoMaybe you shouldn't try so hard to deliberately misunderstand what I'm saying. Your nitpicking doesn't change the fact that you can redefine what == does in your own classes. I hope you do realise that my point isn't even specifically about Scala, but about syntactical abstraction in general.