For example, how can I write an expression where the following is implicitly applied:
implicit def intsToString(x: Int, y: Int) = "test"
val s: String = ... //?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Implicit functions of one argument are used to automatically convert values to an expected type. These are known as Implicit Views. With two arguments, it doesn’t work or make sense.
You could apply an implicit view to a
TupleN:You can also mark the final parameter list of any function as implicit.
Or, combining these two usages of
implicit:However it’s not really useful in this case.
UPDATE
To elaborate on Martin’s comment, this is possible.