3 ms·
> more concise than Python, but safer than Java really? or was that supposed to be the other way around? Personally, I can't help thinking of scala as a hipst
by ljw1001 10y ago
> more concise than Python, but safer than Java
really? or was that supposed to be the other way around?
Personally, I can't help thinking of scala as a hipster beard on the face of java.
- lmm 10y agoYes, really. You can write Scala in a very Python-like style, but "_.foo" is much more concise than "lambda x: x.foo", and class declarations are much more concise too ("class Foo(x: Int, y: String)" rather than "class Foo(object): def __init__(self, x, y): self.x = x; self.y = y"). Compared to Java, the inherent safety level of the type system is very similar, but since it's much lighter weight you can do a lot more of it; "newtypes" are much more concise, and for/yield makes it possible to treat errors as values in a lightweight way rather than using the second parallel type system that is Java checked exceptions.
- 59nadir 10y agoOpinions on Scala aside, it should be said that Python isn't the epitome of conciseness that a lot of people think it is. There are more concise languages out there and languages that are as concise as Python that end up offering more elsewhere.
- lmm 10y agoThere are languages that use a denser notation than Python for the same number of syntactic elements, but I don't think many allow you to express the same things in fewer elements. It's famous for looking like pseudocode, which suggests it contains exactly the information that humans need to communicate.
- 59nadir 10y agoI would argue that pseudocode doesn't present the "end goal" of readable brevity. Without getting into specifics all too much, an example of things that can make code much shorter, yet readable, is piping data through a series of functions, which is something that Python doesn't allow without repetition, as far as I know. There are lots and lots of things you could point to. I don't think the point is to change Python, but I do feel that people who are too snowed in could accept that the time wherein Python was the most concise, yet readable language has passed quite a while ago, so it might be less of an argument for Python than they'd think. The same will end up happening with the "ecosystem argument" as well, by the way. It will be touted as Python's greatest strength 10 years into the future when it no longer holds true, but since it's something that's been repeated for tens of years it'll still be repeated, based solely on history.