Menu

#3 Better IronPython compatability

open
nobody
None
5
2012-12-23
2010-09-19
No

It would be great to be able to handle ref and out parameters the way that IronPython does.
See: http://ironpython.codeplex.com/wikipage?title=FAQ&referringTitle=Home
How can I call a method with ref, out, and params parameters?

Discussion

  • Barton Cline

    Barton Cline - 2010-11-25

    Urs has provided an interesting approach to the out parameter handling which I'll play around with.

    I was actually more interested in the ref parameter creation/in place-modification as demonstrated at http://www.voidspace.org.uk/ironpython/dark-corners.shtml:

    "Similar to out parameters are ref parameters. These need to be initialised with a value, so they can't just be returned as additional values. Instead we create a reference using clr.Reference."

    From C#:

    int value = 6;

    SomeMethod(ref value);

    From IronPython:

    import clr

    reference = clr.Reference(6)
    self.SomeMethod(reference)

    updated_value = reference.Value

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.