7 ms·
Saying that scala is complex is like saying lisp is complex just because you cant read it. Scala has very little syntactic rules. Of course if you dont take th
by camus2 13y ago
Saying that scala is complex is like saying lisp is complex just because you cant read it.
Scala has very little syntactic rules. Of course if you dont take the time to learn them , you are not going to understand the language.
- laureny 13y ago> Scala has very little syntactic rules There are a lot of counter examples to this claim but just to keep this short, I'll go along with your claim. A downside of this is heavy overload of keywords/symbols. For example, last time I checked, the underscore (_) has six different meanings depending on where it's used. The number of syntactic rules is not a good way to judge whether a language is difficult to read, otherwise, Brainfuck would be the most readable language on the planet.
- camus2 13y ago> the underscore (_) has six different meanings depending on where it's used. no it has not ,it always express some kind of default behavior. just like ! in ruby method means mutation or ? means it returns a boolean. > The number of syntactic rules is not a good way to judge whether a language is difficult to read, otherwise, Brainfuck would be the most readable language on the planet. But we are not talking about Brainfuck.
- laureny 13y ago> > the underscore (_) has six different meanings depending on where it's used. > no it has not ,it always express some kind of default parameter. You might want to refrain from commenting on a topic you don't seem to know much about. I was wrong when I said "six", it looks like the number is up to eleven today. Here is a short list: - Existential types - Higher kinded type parameters - Ignored variables - Ignored parameters - Wildcard patterns - Wildcard imports - Hiding imports - Joining letters to punctuation - Assignment operators - Placeholder syntax - Partially applied functions More details: http://stackoverflow.com/questions/8000903/what-are-all-the-uses-of-an-underscore-in-scala http://stackoverflow.com/questions/8000903/what-are-all-the-...
- camus2 13y ago> You might want to refrain from commenting on a topic you don't seem to know much about. the underscore is not an operator.that's why you are listing random stuffs that are not related. It express an intent, see my previous message. You might want to stop patronizing people you dont know. Or your head is too big for that.
- laureny 13y ago> it express an intent, see my previous message. Actually, it can express eleven intents, depending on where it's being used.
- cdcarter 13y ago! in ruby means "dangerous", which is actually poorly defined. In some major libraries it is used to mean exception raising, in some it means self-mutation. The bang (!) does not mean "destructive" nor lack of it mean non destructive either. The bang sign means "the bang version is more dangerous than its non bang counterpart; handle with care". Since Ruby has a lot of "destructive" methods, if bang signs follow your opinion, every Ruby program would be full of bangs, thus ugly. -matz
- zohebv 13y agoAre you the same guy as ramkahen on reddit? _ has only one meaning => "unspecified" http://www.reddit.com/r/programming/comments/uk015/kotlin_m2_candidate/c4w5oz3?context=3 http://www.reddit.com/r/programming/comments/uk015/kotlin_m2...
- pron 13y agoNo it isn't. Scala has three complete type systems: an OO, inheritance based type system, a Haskell-like algebraic type system (sealed traits and case classes), and a duck-typed type system (structural types). Each of these type systems has been enough to write good, complex software on its own (in different languages, of course). Scala's got all three, plus macros. Scala is a superset of Java, Haskell, JavaScript and Lisp; such a language is not simple. A language where it takes an expert to understand how the standard library's linked list is implemented is not simple (even the language creators say that understanding, let alone implementing, Scala collection classes is reserved for experts). You may well understand parts of it, most of it or even all of it given enough time, but it is definitely not simple. EDIT: Scala does have an incredible compiler, though, and it is interesting from a PL research POV (which is to be expected, given its origins). The JVM community will forever be indebted to Scala. But it is not a language that many will feel comfortable using, and most of those that do, use a subset of it (which is basically Kotlin), and ignore the fact that they can't understand how the linked list is implemented. Kotlin takes a lot of inspiration from Scala, obviously, and learns from its mistakes. It takes that subset of Scala that gives people 99.9% of what they want and need with only 10% of the complexity.
- konstruktor 13y agoI like that you can even explain why it is complex. I was just able to give an example, that is explained by your argument (a type system for a purely functional language as opposed to a mix of everything).
- lmm 13y agoScala's standard library linked list is complex, sure. But it's also considerably more powerful than any equally safe implementation in any language, and considerably safer than any equally powerful implementation. If anything the fact that such complex libraries are written in it is evidence of scala's simplicity - if the language itself were complex, it would consume too much of one's attention for it to be possible to write such complex libraries.
- pron 13y ago
- konstruktor 13y agoThis reminds me of one of my favourite Stackoverflow threads, where Odersky himself explains in just a few paragraphs why the signature of the map function in Scala is not overly complicated: http://stackoverflow.com/questions/1722726/is-the-scala-2-8-collections-library-a-case-of-the-longest-suicide-note-in-hist http://stackoverflow.com/questions/1722726/is-the-scala-2-8-... I am not joking when I say that they have actually introduced "simplified signatures" into the API docs after this :) So yeah, if it takes several paragraphs to explain why something that can be as straightforward as this (Haskell) (a -> b) -> [a] -> [b] is actually not that complicated when it looks like this def map[B, That](f: (A) ⇒ B)(implicit bf: CanBuildFrom[List[A], B, That]): That it is clearly the stupid infidels that don't get it. This doesn't mean that Scala is a bad language in general, just that it is ridiculous to state that it isn't complex, especially compared to Lisp.
- asdf1234 13y agoAs Martin points out in his response, the Scala version of map isn't restricted to returning a list so (a -> b) -> [a] -> [b] isn't directly comparable. To make a similar version in Haskell you'd have to use a language extension (MultiParamTypeClasses?) and the type signature would be significantly more complex. It's debatable whether the complexity of the API is worth the additional functionality, but the basic version of map (Data.List.map :: (a -> b) -> [a] -> [b]) is utterly trivial in either language.
- burntsushi 13y ago> To make a similar version in Haskell you'd have to use a language extension (MultiParamTypeClasses?) and the type signature would be significantly more complex. Eh? No language extensions necessary. fmap :: Functor f => (a -> b) -> f a -> f b Perhaps I'm missing something though...
- lmm 13y agoThat can only be used with a fixed functor f; the scala version can send an (a -> b) to a (f a -> that), for any [a, b, that] combination for which a CanBuildFrom is available (this is basically a more generalized typeclass).
- riffraff 13y ago> Scala has very little syntactic rules. Are you sure this is true? Compared to what?
- lmm 13y agoThe SLS is approximately 1/3 the length of the JLS