RE: Major change proposal
"Mark Hahn" <[email protected]> Wed, 4 Aug 2004 22:08:03 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <000101c47aaa$302952a0$0d01a8c0@MarkVaio> |
Paul Prescod wrote:
> I'm having trouble understanding what you mean. When you say
> a "built-in
> object" do you mean like None? Or do you really mean built-in
> object types?
I mean built-in object types. I may be totally wrong at this early point,
but as an example, he declares a C# class called List with all the built-in
List methods:
public class List:IMutableSequence,IList,IComparable {
private int size;
private object[] data;
...<snip>...
public void append(object item) {
EnsureSize(size+1);
data[size] = item;
size += 1;
}
...<snip>...
So when Python is running, it is actually running on real CLR objects with
CLR methods. I don't know how he dispatches dynamically to these static
types yet.
For every List instance there is a reflection object that can hold
attributes etc. So dynamic operations like setAttr() etc. operate on a
combination of the real objects and the reflection objects.
I haven't looked at how his implementation of pure dynamic objects works
yet. I'm having to learn C# and read his code all at the same time.
I'm already less worried about the prototype versus classes thing though.
Just because he's using the native C# classes doesn't mean he's using the
native inheritance. The built-ins don't use any inheritance to speak of and
the native inheritance doesn't support mutiple inheritance. You'll notice
in the sample above he's only inheriting interfaces, not classes.