[Kde-bindings] Qyoto ARGB windows using C++ QApplication hack: crashes

Arno Rehn arno at arnorehn.de
Sun Mar 2 11:55:08 UTC 2008


Am Sonntag 02 März 2008 11:03:41 schrieb Richard Dale:
> On Saturday 01 March 2008 23:49:56 Arno Rehn wrote:
> > > That's good news. I read in one of your commits about generating a lot
> > > of partial classes for kde/kimono, and I remembered adding support for
> > > generating nested classes in the same c# source file, and I wondered if
> > > we were moving in different directions.
> >
> > Oh, I forgot to mention that: I changed kalyptus to make every class
> > partial, not only those that are explicitly listed. This makes it easier
> > to have even the nested classes in a seperate file. The partial classes
> > don't create problems so it should be ok.
>
> Well if it was a good idea for every class to be open there wouldn't be a
> need for the 'partial' keyword in C#. All classes in Ruby, Objective-C and
> other languages are open and so this isn't unreasonable, but it seems to be
> going against the 'spirit of C# design' to me and I would prefer we only
> had partial classes when we needed them.
Well, 'partial' only means the classes are open at compilation time. You 
can'ta extend them later when you just reference the assembly. That's only 
possible while you are writing the 'original' version of the class. C# 3.0 
introduces the so-called 'extension methods' with which you can extend 
classes after compilation, but this doesn't have anything to do with partial 
classes.

> > Originally I wanted C++ namespaces to be converted to C# partial classes,
> > too, so that the C# API would more resemble the C++ one (e.g. that you
> > could write Kimono.KIO.SomeMethod() ), but that lead to the gmcs crash we
> > talked about a few weeks ago. Now there is an extra class for the
> > namespace methods if there are any. So you have to write
> > Kimono.KIO.KIONamespace.SomeMethod() if you want to access a method
> > that's in the original C++ KIO namespace. This 'new' naming scheme is not
> > applied to the Qt classes to keep the old API and old code working.
>
> I was going to have a KIO class with the other classes nested within it.
> Then the C++ standalone methods in the KIO namespace would become C#
> methods in the KIO class. Are you saying that scheme didn't work, or were
> you trying KIO as a C# namespace?
>
> If we had to have the above scheme I would prefer
> Kimono.KIO.Namespace.SomeMethod() to Kimono.KIO.KIONamespace.SomeMethod().
What we have to take into consideration is that we should differentiate the 
names. If you e.g. have

using Kimono;
using Kimono.KIO;
using Kimono.DOM;

and say Namespace.SomeMethod() the compiler can't differentiate if you mean 
Kimono.KIO.Namespace.SomeMethod() or Kimono.DOM.Namespace.SomeMethod(). So in 
the end you would end up writing the whole fully qualified name like 
Kimono.KIO.Namespace.SomeMethod() which somehow defeats the purpose of the 
using-directive.

> <copied from other mail>
> The best equivalent of Qyoto.Qt would be Kimono.KDE I 
> would have thought.
Yes, that's right. But if you apply this to the other namespaces you would get 
something like Kimono.KIO.KIO. I already had something like this in mind but 
it would (in my opinion) overcomplicate the code generation because you then 
need to write the fully qualified name in the generated classes again since 
the compiler can't differentiate between the KIO namespace and the KIO class 
in this namespace.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list