Scala – Historical Origins of Scala Implicits

historyprogramming-languagesscala

Scala has been called complex with its rich feature set by many of my colleagues and some even blamed all those new features of it. While most programmers are aware of the OO-features, and at least the decent ones also know about functional programming, there is one feature in particular in Scala for which I am not aware of its historical origins.

Given that a major mantra of our profession is to not reinvent the wheel, I am rather confident, that Scala does not have any actual unheard-of-before features, but I stand to be corrected on this one if necessary.

To get to the actual question, while I am aware of the origins of most of Scala's features I have never seen something like its implicit declarations before. Are there other (older!) languages out there which also provide this feature?

Does it make sense to distinguish the different cases of implicits (as they may originate from different sources), namely implict conversions and implicit parameters?

Best Answer

I disagree with Brian's answer on that other question.

As far as I know, there's no implicit concept on any other language. The change history for Scala implies that implicits were a generalization of view bounds, and a view bound is, itself, a generalization of automatic type conversion, which is very common indeed.

Implicits then enabled type classes, but I'd be very surprised if that was the original intent.

Edit

The release notes for Scala 2.0 (2006) say:

Views in Scala 1.0 have been replaced by the more general concept of implicit parameters

That doesn't mean, of course, that implicit parameters were introduced with the goal of replacing views.

However, Odersky clearly likes it when once concept can replace multiple ones. In that sense, it may well be the case that Odersky wanted type classes, but did not want to introduce a mechanism to handle that exclusively, and, therefore, came up with something else that let him remove one concept (Views) and replace it with a more generic concept that handles both views and type classes.

In case anyone is interested, Poor Man's Type Classes, referred to by Brian back at Stack Overflow, is dated 2006 as well. Clearly, Odersky was aware of the link between implicits and type classes when he introduced them.

Yet, I stand by my claim. :-)

Related Topic