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

Make mirroring less cumbersome #35

Open
TiarkRompf opened this issue Sep 26, 2012 · 1 comment
Open

Make mirroring less cumbersome #35

TiarkRompf opened this issue Sep 26, 2012 · 1 comment
Labels

Comments

@TiarkRompf
Copy link
Owner

Add a default case for mirrorDef using reflection.

Evaluate whether mirror can be made a method on Def (or a subclass). This would allow writing:

case class MyNode(x: Exp[A]) extends MirrorDef {
  def mirror(t: Transformer) => myop(t(x)))
}

def myop(x: Exp[A]) = MyNode(x)

Or:

case class MyNode(x: Exp[A]) extends MirrorDef(t => myop(t(x)))

def myop(x: Exp[A]) = MyNode(x)

Which may be simpler than the current mirror overrides.

@TiarkRompf
Copy link
Owner Author

Note: in the second version extends MirrorDef(t => myop(t(x))) we'd need to figure out how to pass the implicit SourceContext. Is there a better way than making it part of the Def instance?

@TiarkRompf TiarkRompf removed this from the 0.8.0 milestone Aug 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant