Is using Interceptors the only way for a mixin to interact with the calling class other mixins?
I’m looking to do something like below.
PsuedoCode
class speak
void Greet()
{ Console.WriteLine("Greetings! My Name is " + self.firstname); }
class person
string firstname;
SpeakingPersonProxy = MixIn(person,speak);
SpeakingPersonProxy.firstname = "Noneya"
SpeakingPersonProxy.Greet() //produces Greetings! My name is Noneya
self.firstname(or something like it) would somehow point to class using greet, instead of the speak class. Ruby has a similar concept, which makes sense for a dynamic language. Was wondering how to achieve this in DynamicProxy.
There’s nothing built in, but what’s stopping you from:
so in other words, if the
speakhsa to know about its target, be explicit.