4 ms·
Scala has one out of the sight interface: interface Function { call(...); }. // of course this is a made up syntax. For most of the cases, this is just enough
by eveningcoffee 12y ago
Scala has one out of the sight interface:
interface Function { call(...); }. // of course this is a made up syntax.
For most of the cases, this is just enough (as it is also in Java).
- the_af 12y agoI'm sorry, I don't understand your comment. Can you clarify what you mean, using actual Scala syntax if possible? (Just so I understand). In any case, my point is that since there are usable OOP languages without Java-like interfaces, this kind of interfaces isn't necessary. That is, there are alternative ways of producing usable OOP languages. It doesn't necessarily follow that Java is successful because of its implementation of interfaces.
- eveningcoffee 12y agoMy point was that, as functions are treated as objects in Scala, you actually have a hidden one method interface behind each function implementation.
- the_af 12y agoFunctions are implemented as objects in Scala, but this is an implementation detail. Scala implemented over something else than the JVM could have done first-class functions differently. Also, the notion of "interface" we're discussing here (and Uncle Bob is railing against) is the Java-like interface (i.e. using the actual "interface" keyword that disallows implementation, and not abstract classes). Those are not used in Scala. Therefore, they are not required for successful OOP languages. Note I think Uncle Bob's condescending tone in TFA is pretty useless. The entire article consists of building a strawman. He really annoys me.
- eveningcoffee 12y agoYou can see this as an implementation detail or also as a conceptual detail.
- the_af 12y agoI don't think it's conceptual. It's a technical detail. If they had been implemented differently, this would have made little difference to the programmer using Scala. Again, Objects aren't Java interfaces, so I guess the whole discussion is moot :)
- eveningcoffee 12y agoYes, this is conceptual as you can conceptually regard functions as objects and it may have great benefits as a tool to communicate the idea to the other people. There are of course other abstractions with their own benefits.
- the_af 12y agoI disagree. Regardless, Objects aren't Java interfaces, so what are we even discussing? Uncle Bob wasn't arguing against the general concept of an interface, but about its specific meaning in Java.