.NET Attributes have a similar calling mechanism in C#: [FooAttribute(1, 2, A=3, B=4)] To use the named parameters, I believe FooAttribute must implement A and B as properties. Since attributes are classes, one can instantiate them, and set properties at that time. Not exactly the way I think it'd work for a method, but I imagine compiler magic would happen similarly, without ambiguity. blah() bar = foo(b=3) blah() -> blah(); fooParams = new FooParams(); fooParams.b = 3; bar = MagicFoo(fooParams); blah(); ..... private struct FooParams { aType a; bType b; cType c; public FooParams() { this.a = defaultA; this.b = defaultB; this.c = defaultC; } } private FooReturnType MagicFoo(FooParams fooParams) { return foo(fooParams.a, fooParams.b, fooParams.c); } Disclaimer: you don't want to know what I'm talking out of. I'm just in it for the fun thought experiments. ... and to avoid thinking of how long it takes Eclipse to get out of swap space.
________________________________ From: [EMAIL PROTECTED] on behalf of Ryan Davis Sent: Fri 4/29/2005 1:48 PM To: 'Discussion of IronPython' Subject: RE: [IronPython] Executing a python source from C# What I'd really like is the ability to create a .dll that we reference in other .NET apps, just as now we can write a class library in C# and use it in a VB.NET web application. I have zero clue of the complexity of that task, but that'd be my ideal. I imagine that'd be pretty hard, given the differences in function declaration semantics alone. I'm thinking of **kwargs and default parameters, specifically. I don't know how that would map to a C# compatible signature. I guess for default parameters: def foo(a=1, b=2, c=4): you could make successive overloads that call one "master" version: int foo(a) int foo(a,b) int foo(a,b,c) but then there's no way to do the equivalent of foo(b=3) without running into ambiguity, and you end up having to do a lot more function calls than you really should. .. back to C# sloggery.
<<winmail.dat>>
_______________________________________________ users-ironpython.com mailing list users-ironpython.com@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com