Dino,

thanks for the informative answer with samples. I agree with what you write,
but that was not what I had in mind. Consider this c# code:

IPerson foo = new Person();
foo.Name; // works in c#, because foo is of type IPerson.

in ipy, I can not explicitly define an Interface type like
foo = IPerson(Person())

And even if I pass the IPerson to ipy, ipy will "see" the first
implementation, not the type I am passing. So, If I have something like
this:

locals["foo"] = foo;, where foo is defined as:

IFoo1 foo = new Foo() as IFoo1;
where

Foo: BaseFoo, IFoo1, IFoo2

and BaseFoo is defined as

BaseFoo : IFoo1, IFoo2

and IFoo1 { string Name {get;set;}}

then Python will "see" the object passed in as BaseFoo, as this is the only
implementation (although we want to pass in the "contract", interface
IFoo1).

I know it looks complicated... In short:
If I pass ISomething to c#, I can call it. If I pass ISomething to ipy, it
"knows better" and treats it as BaseSomething or whatever the first class
is. ;)
Maybe a strong-typed method of passing in the locals/globals would help.
Something like anonymous types, perhaps?

IMyInteface myInterface = ....
engine.Execute("print foo.Name", eng.CreateModule(), new { foo = myInterface
});

Miha

On Jan 23, 2008 9:35 PM, Dino Viehland <[EMAIL PROTECTED]> wrote:

>  I agree, we should document it, unfortunately our documentation is still
> woefully inadequate  L.
>
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to