Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get lambda code passed to a function using sourcecode.Args #86

Open
lokifacio opened this issue Jan 19, 2020 · 0 comments
Open

Comments

@lokifacio
Copy link

Is there a way to get the source code of the lambda function passed to another function?

I get the expected result with basic types

def myBasicFunc(param: Int): String = {
 sourcecode.Args().head.head.toString
}

myBasicFunc(4) // Text(4,param)

But when I try to use the same approach with lambda functions I only get the generic function1 value

def myLambdaFunc(param: Int => Int): String = {
 sourcecode.Args().head.head.toString
}

myLambdaFunc(x => x*2) // Text(<function1>,param)

Is this the expected behavior? Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant