On 10/17/07, Joe Mason <[EMAIL PROTECTED]> wrote: > > On 10/17/07, Keith J. Farmer <[EMAIL PROTECTED]> wrote: > > Forgive my non-C-ness (it's been a long time since I wrote a native > module > > for Python), but aren't you now buying into a major re-implementation of > all > > the native Python standard library into C#? > > Couldn't the C/C# API just use IronPython objects and methods to > "implement" the Python standard library?
Yes, that would be the idea. I think it's best when thinking about the architecture to have a specific example to refer to. With that in mind, I'm going to repeat some code I wrote earlier in the thread (with a few modifications). PyObject * ReverseSequence(PyObject * self, PyObject * args) { PyObject * columns; if (!PyArg_ParseTuple(args, "O", &columns)) { return NULL; } if (!PySequence_Check(columns)) { PyErr_SetString(PyExc_ValueError, "must be a sequence"); return NULL; } int length = PySequence_Length(columns); PyObject * result = PyTuple_New(length); for (int i = 0; i < length; i++) { PyObject * value = PySequence_GetItem(sequence, i); // Don't remember if I need to INCREF value PySequence_SetItem(result, length - i - 1, value); } return result; } Obviously, this isn't a "real-world" example, but it does show a few requirements for the compatibility layer. 1) The code expects a sequence. What kind of data should we be allowed to pass to it from IronPython? 2) The code returns a "tuple". How will this tuple be translated into a CLR object for consumption by IronPython? -- Curt Hagenlocher [EMAIL PROTECTED]
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com