Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What was the reason to restrict on combining implicit parameters and view/context bounds?

One of the recent commits to Scala master removes restriction on combining context/view bounds with implicit parameters. That's a great improvement that reduces amount of boilerplate, but what was the reason of making that restriction before, and what consequences can we expect now?

like image 909
Vasil Remeniuk Avatar asked Jul 26 '11 21:07

Vasil Remeniuk


1 Answers

Context and view bounds add implicit parameters. So if you write:

def f[T : Manifest](l: List[T])(implicit ord: Ordering[T]) 

There are, in fact, two implicit parameters being passed instead of one. Allowing this kind of syntax will certainly result in some confusion down the road. As implicit parameter usage starts to get more widespread, because of type classes, being able to do something like the above is helpful.

like image 50
Daniel C. Sobral Avatar answered Nov 15 '22 04:11

Daniel C. Sobral