[IronPython] Interface in IronPython

2007-03-12 Thread Ed Fialkowski

Hi all, I'm pretty much totally new to IronPython and have come to the
point that I need an interface to interact with a co-worker's code,
but I can't seem to find any documents or discussion on syntax for
writing an interface.

Does anyone know of a link that talks about interfaces in IronPython
or feel like explaining one too me? :)
Any advice would be greatly appreciated.
Thanks.
-Ed
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Interface in IronPython

2007-03-12 Thread Curt Hagenlocher

If you mean a CLR interface, you will have to define it in a C# or
VB.NETassembly and then derive from that interface in IronPython.
There's not
currently any way to define a CLR interface from IronPython.

On 3/12/07, Ed Fialkowski [EMAIL PROTECTED] wrote:


Hi all, I'm pretty much totally new to IronPython and have come to the
point that I need an interface to interact with a co-worker's code,
but I can't seem to find any documents or discussion on syntax for
writing an interface.

Does anyone know of a link that talks about interfaces in IronPython
or feel like explaining one too me? :)
Any advice would be greatly appreciated.
Thanks.
-Ed
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Interface in IronPython

2007-03-12 Thread Alex Willmer
On Mon, 2007-03-12 at 17:12 -0500, Ed Fialkowski wrote:
 Hi all, I'm pretty much totally new to IronPython and have come to
 the 
 point that I need an interface to interact with a co-worker's code, 
 but I can't seem to find any documents or discussion on syntax for 
 writing an interface. 

Do you mean calling an interface defined by your co-worker, or
implementing an interface in IronPython for you co-worker to call?

 Does anyone know of a link that talks about interfaces in IronPython 
 or feel like explaining one too me? :) 

To my knowledge you cannot create a class in IronPython to be consumed
by C# or VB. I don't know if an IronPython class can implement an
interface.

To call an explicitly implemented interface, or access the properties of
an explicit interface use the following:

ISomeInterface.MethodName(instance, args)
ISomeInterface.PropertyName.GetValue(instance)
ISomeInterface.PropertyName.SetValue(instance, value)

As you've probably found attempting to cast, fails.

If you need to perform the equivalent of the C# expression 'instance is
ISomeInterface' (a QueryInterface?), then you'll find isinstance()
fails. Instead, for now use:

clr.GetClrType(ISomeInterface).IsAssignableFrom(clr.GetClrType(type(instance)))

Here are a couple of relevant bug reports:

http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=4538
http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=1506

My thanks to Shri Borde for helping me understand this.

Regards, Alex

___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Interface in IronPython

2007-03-12 Thread Ed Fialkowski

I did mean create an interface in IronPython for my co-worker to call, but
we've since come to the conclusion it doesn't seem possible.

Thanks very much for confirming.

-Ed
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com