Re: When are scala macros expanded?
Andrew Phillips <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <[email protected]> |
Hi Jeremy Without having spent much time trying to come up with a creative approach, I would be surprised if what you're trying to do were possible. If I understand your problem statement correctly, you're trying to add a condition to a method defined on an interface "after the fact:" an additional (implicit) parameter, in this case. Yet this condition is only supposed to be checked for by the compiler if the implementation class of the interface happens to be *your* specific class. Which would seem to require that the compiler know up front what the *runtime* class of the implementation will be. If I write: val myObj: SomeInterface = ... myObj.foo(...) I would imagine that the compiler can *only* verify that my attempt to call foo is compatible with the definition of foo in SomeInterface, i.e. the static type of myObj. I don't see how, at compile time, we would be able to say: "Ah, if myObj in this case happens to be an instance of SpecialImplOfSomeInterface, we need to check for an extra implicit/parameter/parameter list/whatever." Curious to see what other participants in this thread will come up with! Regards ap -- You received this message because you are subscribed to the Google Groups "scala-language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.