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

Better handling of higher-order functions #1

Open
dragos opened this issue Jan 12, 2011 · 2 comments
Open

Better handling of higher-order functions #1

dragos opened this issue Jan 12, 2011 · 2 comments

Comments

@dragos
Copy link
Owner

dragos commented Jan 12, 2011

Function literals may confuse the plugin. For instance,

  val xs = List(1, 2, 3)
  xs map (x => x)

is translated to

  val xs = List(1, 2, 3)
  xs map (new anonfun extends AbstractFunction1$II {
    def apply(x: Object) = apply(x.toInt) // boxing
    def apply(x: Int) = x
  })

but, if map is specialized, no boxing will occur (the apply(Object) overload is never called).

@dragos
Copy link
Owner Author

dragos commented Jan 12, 2011

Maybe suppress warnings when the closure is passed to a specialized method. More generally, for an application where the method is specialized and the argument is a a (matching) specialized instance, ignore generic forwarders.

@magicgoose
Copy link

I think the problem must be detected at runtime... One silly way is simply add a logging with stack trace in constructors of every primitive wrapper classes. Because is is not so easy to track whick methods of specialized classes will really be called. Correct me, if I'm wrong.

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

No branches or pull requests

2 participants