[IronPython] Re: users-ironpython.com Digest, Vol 2, Issue 3

Nick Bastin nbastin at opnet.com
Thu Sep 2 23:23:55 CEST 2004


On Sep 2, 2004, at 5:08 PM, Curt Hagenlocher wrote:

> Nick Bastin <nbastin at opnet.com> writes:
>
>> On Sep 2, 2004, at 3:10 PM, Randall Burns wrote:
>>
>>> Why can use of static types be done in libraries
>>> specfic to IronPython? That would given IronPython
>>> programs a limited interface using static types to
>>> call DLL's and such -or am I  missing something here?
>
> Well, you have to define a langauage construct before you
> can implement anything at all.  It's not a core library vs
> IP-specific library issue.
>
>> Couldn't we use decorators to create native interfaces to any
>> function we wanted to expose?  This would be similar to the use
>> of decorators in pyobjc.
>
> Yes, decorators could probably serve that purpose.  I haven't been
> following CPython since 1.6, but I understand that decorators have
> been added or are being added to an upcoming release.  Can you
> decorate parameters, also, or just functions and classes?  Ideally,
> you'd want to decorate a parameter with its type, otherwise you're
> back to a syntactical issue.

You decorate a function (in 2.4).  You can effectively decorate the 
parameters by decorating the function with an appropriate decorator:

@CLRTypes([CLR.Integer, CLR.String])
def my_func (a, b):
	pass

or something like that.

> Can you point to an example in pyobjc?  I tried to find something
> on the site, but I got too irritated at their slow-rendering header
> and gave up.  From what I remember about ObjC, though, the
> language supports sending messages to objects without knowing
> anything about the object.  This is a lot more compatible with
> the Python object model than the C#/VB model, where everything
> is strongly typed.

They don't concern themselves with the type, but the signature is 
significant for the selector, so they are planning on using a 
decorator.  You'll actually have to look at the mailing list, or the 
py-dev mailing list to see the syntax, since decorators were just added 
to Python 2.4 alpha, and are not a part of the standard pyobjc yet.

--
Nick




More information about the Ironpython-users mailing list