For example:
def factory(_name: String) = new Person {
val name: String = _name
}
I’m looking to avoid mangling the name of _name in the outer scope.
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.
While far from an ideal approach, this “does the trick”:
I don’t know of any other way to get close. There is a section in the Scala Language Specification (Chapter 2) which talks about shadowing — and in no place does it discuss a way to qualify those “implicit” scopes.
Happy coding.