5 comments

0

This gives the false illusion that Scala is better than C++

https://rosetta.alhur.es/compare/C++/Scala/#

But here is my version:

class Camera {};
class MobilePhone {};
class CameraPhone:  public Camera, public MobilePhone {};
trait Camera
trait MobilePhone
class CameraPhone extends Camera with MobilePhone
0

I don't know much about either of those languages, so I don't know one way or the other. And I don't think the point of the site is to try to make any language seem better than another. It's just comparing them. Also, the code snippets are from Rosetta Code, and quite possibly aren't the best examples of how to code what they are trying to achieve.

And your version of what? That wasn't meant to be snarky, I honestly am not sure what you're referring to. Your code appears to be a simple example of object classes and inheritance?

0

I just rewrote the C++ version that gave the impression that you needed more lines to do the same. Most of the C++ examples wast many lines by putting the {} on separate lines.

0

Reverse words in a string is worse... Its more indicative of the skill and style of the person submitting the code for the example. If you look at C vs Java its even more so, (also some of the C code is buggy)

0

Well it's good to know that the examples are shit. I wouldn't know, considering I don't know most of the languages there. And even the ones I do know, I don't know well enough to tell whether someone's implementation of something is shit.

I'm, personally, just happy if something I write works at all.