News for hackers. Stuff that matters.
Re:Another Scala rant on HN by weak on Tuesday December 03, 2013 @07:40AM (#6839884)
If you asked me 6 months ago I would say the features that confused me the most:

- Covariance / Contravariance - Implicit Parameters - Implicit Conversions - and also mentioned here, Structural typing.

However now that i've spent time with the language, seen these in action and used them myself I see the reason why they exist and embrace them. I can see why this would be a common complaint against Scala and can be a barrier for a lot, but I think the language is worth investing time in learning, at least for me.

Re:Another Scala rant on HN by pkolaczk on Tuesday December 03, 2013 @08:14AM (#6840001)
Covariance / Contravariance - Noooooooo! I admit - this might be hard to grasp at first, but in reality it is very simple concept that simplifies a lot of code. It is enough to get variance right once for a class, instead of fighting with ? in Java everywhere.

BTW: Kotlin has copied it and noone complains it is too complex :D

As of implicit parameters / implicit objects - ok, but what do you suggest as a replacement so that map/filter/reduce preserve types correctly? Or how do you do type-classes then?

Re:Another Scala rant on HN by jerf on Tuesday December 03, 2013 @09:12AM (#6840309)
"As of implicit parameters / implicit objects - ok, but what do you suggest as a replacement so that map/filter/reduce preserve types correctly? Or how do you do type-classes then?"

I don't have a specific answer to this question, but I do want to warn you that this is a dangerous line of reasoning. Given a complicated object like Scala or C++, you can easily have a situation where each individual element is necessary to support two or three other elements of the overall structure, yet, the overall structure can still be too complicated.

And to be clear, I'm not even saying you're wrong. Maybe there isn't a better choice. Scala's choice to be compatible with Java creates a very strange design situation. I'm just saying, this isn't a safe line of reasoning. I think it makes it very easy to become very short-sighted about your options by encouraging you to always be very locally focused.

Re:Another Scala rant on HN by CmonDev on Tuesday December 03, 2013 @08:31AM (#6840083)
Agreed, Covariance / Contravariance was a fantastic feature to borrow from C#! It just should have been implemented to be friendlier to people new to language.
Re:Another Scala rant on HN by tikhonj on Tuesday December 03, 2013 @09:27AM (#6840401)
Variance has been well understood in PL theory in basically forever. None of the languages had to borrow it from each other because they could all just get the inspiration from type theory.
Re:Another Scala rant on HN by pkolaczk on Tuesday December 03, 2013 @08:59AM (#6840232)
Ehm... No. If any, C# borrowed it from Scala. C# got them in version 4.0, which was first half of 2010. Scala had them since I remember (from day 1?) - for sure they were in Scala 2.6, which was released in 2006.
Re:Another Scala rant on HN by firepoet on Tuesday December 03, 2013 @08:52AM (#6840198)
Is that where he borrowed it from? I've seen mention of the language feature showing up in Eiffel, Sather, and so on. http://en.wikipedia.org/wiki/Covariance_and_contravariance_(...
Re:Another Scala rant on HN by MichaelGG on Tuesday December 03, 2013 @12:16PM (#6841610)
And C# could only add it because the now-F# folks had originally designed it into the CLR Generics system. It's highly unlikely C# would ever go far out of the straightforward IL generation it does to implement such a feature otherwise.
Re:Another Scala rant on HN by Locke1689 on Tuesday December 03, 2013 @08:17PM (#6844415)
Nope. The CLR has supported it back to v2, and C# delegates used the feature before language support was added in C# 4
Re:Another Scala rant on HN by MichaelGG on Tuesday December 03, 2013 @11:57PM (#6845114)
Right, variance was part of the original MSR proposal for CLR Generics.

How did delegates use variance? I've never been terribly clear on the whole delegates concept - they're like first class functions, except nominally typed and weird.

Re:Another Scala rant on HN by CmonDev on Tuesday December 03, 2013 @11:13AM (#6841115)
Sorry guys, I stand corrected :).