[IronPython] CallTargetX delegates

Michael Foord fuzzyman at voidspace.org.uk
Mon Sep 14 20:04:27 CEST 2009




--
http://www.ironpythoninaction.com

On 14 Sep 2009, at 18:59, Dino Viehland <dinov at microsoft.com> wrote:

> To use Func you just need to do:
>
>
>
> import clr
>
> clr.AddReference(‘System.Core’)
>
> from System import Func
>
> Func[object, object](targetCallableHere)
>
>
>
> This is equivalent to CallTarget1.  You can add more “object, “  
> or you can replace object with some other type.
>
>

It is of course dependent on .NET 3.

Michael



>
>
> From: users-bounces at lists.ironpython.com [mailto:users- 
> bounces at lists.ironpython.com] On Behalf Of Brian Curtin
> Sent: Monday, September 14, 2009 10:53 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] CallTargetX delegates
>
>
>
> How would someone replace CallTargetX with Func<...> within a  
> script? For example, how would you change the Invoke calls in  
> onChanged and onRenamed here: http://www.ironpython.info/index.php/Invoking_onto_the_GUI_%28Control%29_Thread
>
> I've never seen how to use Func within an IP script, just within C#.
>
>
> On Wed, Sep 2, 2009 at 04:59, Davy Mitchell <daftspaniel at gmail.com>  
> wrote:
>
> Could someone pop an example of this on http://www.ironpython.info?
> Sounds like it could be a common 'gotcha' especially for newbies
> running old example code.
>
> Cheers,
> Davy
>
>
> On Wed, Sep 2, 2009 at 6:38 AM, David Escobar<davidescobar at ieee.org>  
> wrote:
> > Ok cool. I've used Func<> from C# before. That did the trick.  
> Thanks.
> >
> >
> > On Tue, Sep 1, 2009 at 6:19 PM, Dino Viehland  
> <dinov at microsoft.com> wrote:
> >>
> >> Yes.  CallTarget’s were really a part of IronPython’s internal  
> calling
> >> convention for used defined functions.  We kept CallTarget0  
> around because
> >> we knew lots of users had come to depend on that one when they  
> needed a
> >> delegate type.  But we removed all the others and switched to  
> using Func<…>
> >> internally.  Ideally you can switch to using Func<> as well.
> >>
> >>
> >>
> >> From: users-bounces at lists.ironpython.com
> >> [mailto:users-bounces at lists.ironpython.com] On Behalf Of David  
> Escobar
> >> Sent: Tuesday, September 01, 2009 5:41 PM
> >> To: Discussion of IronPython
> >> Subject: [IronPython] CallTargetX delegates
> >>
> >>
> >>
> >> In IronPython 2.6 beta 2, did the CallTargetX delegates get moved  
> to
> >> another module or were they simply removed altogether? The only  
> delegate in
> >> IronPython.Compiler is CallTarget0. I checked IronPython 2.0.2  
> and it has up
> >> to CallTarget16.
> >
>
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> >
>
>
>
> --
> --
>  Davy Stuff  - http://daftspaniel.blogspot.com
>  Geeky Stuff  - http://daftpython.blogspot.com
>  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090914/8e5d76a0/attachment.html>


More information about the Ironpython-users mailing list