[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Vala] Vala object model



+1


Yu
On Thu, 2008-08-07 at 17:46 +0000, Juan Luis Paz wrote:
> I'm very interesting in this project, congratulations for this
> excellent job. 
> 
> I'm a C# and java programmer, and gnome user, but I never programmed
> using the GObject type system; I'm learning about that for understand
> the background of Vala
> 
> I'm some suggestion for us about the Vala object model,
> 
> In this moment vala have two kind of object, the object based in glib
> and the others tagged as "compact", all class are automatically based
> in glib except the classes tagged with the compact attribute; in the
> glib exists two fundamental base class, the GTypeInstance (actually
> named TypeInstance in the glib vapi file, with the comment:
> "deprecated") and GObject (actually named Object in the glib vapi
> file), the second extends the first; and all class without super class
> extends automatically from GTypeInstance
> 
> I propose create a logical class named "any" and all class registered
> in vala extends "any" (like Eiffel program language), all base class
> for any type systems extends "any" and all compact class extends
> "any" (the compact class is a reduced type system). "any" is the
> logical super super class in vala, for this extends all elements
> registered in vala: classes, structs, etc.
> 
> With "any" class, the object model look like:
> 
> any
>   |
>   + ----- GTypeInstance
>   |              |
>   |              + ---- GObject
>   |                           |
>   |                           + ---- MyGObjectClass
>   |
>   + ----- MyCompactClass
>   |
>   + ----- AnotherCompactClass
>   |
>   + ----- AnotherTypeSystem
>                 |
>                 + ---- MyClassWithAnoterTypeSystem
> 
> For more usability I propose create two aliases:
> object = GTypeInstance (actually TypeInstance)
> gobject = GObject (actually Object)
> 
> object is the super class for all gobject type system based class,
> like java and C#
> 
> Why object is GTypeInstance instead GObject?
> Because GTypeInstance can be handle all gobject type system based
> classes, this is the real superclass for all types based in gobject
> type system
> 
> For prevent confusion when use gobject type system with another I
> propose rename this classes (from the glib vapi file):
> "Type" to "GType"
> "TypeInstance" to "GTypeInstance"
> "Object" to "GObject"
> 
> For close the large discussed issue about the default base class, I
> propose change it for GObject, this is the natural base class for the
> news classes; for use another super class must be indicate explicitly.
> Example:
> 
> class acme { /*...*/ } // acme extends from GObject
> class acme : Glib.GObject { /*...*/ } // acme extends from GObject
> class acme : gobject { /*...*/ } // acme extends from GObject
> class acme : object { /*...*/ } // acme extends from GTypeInstance
> class acme : Glib.GTypeInstance { /*...*/ } // acme extends from
> GTypeInstance
> class acme : any { /*...*/ } // acme is a compact class
> 
> Actually 
> class acme : gobject { /*...*/ }
> must be write as:
>     class acme : Glib.Object { /*...*/ }
> 
> and
>     class acme : object { /*...*/ }
> must be write as:
>     class acme { /*...*/ }
> 
> Now, the compiler can identify the compact class without the compact
> attribute, it is unnecessary and can be dropped
> 
> About the use of "any":
> 
> "any" is a metaclass, and this does not indicate how to handle its
> memory; unknown how handle its memory makes impossible to use "any" as
> type of  argument, variable, field, etc. then, the valid use of "any"
> is in a pointer, any* is the same as void*
> 
> Note:
> I prefer any* instead of void* because any* is has a logic reason,
> void* is magic and illogical, but void* is very common
> 
> Note:
> In the variable argument list, the data type of "..." is any
> 
> Note:
> I'm not sure, but I think some methods in GObject class are
> GTypeInstance methods like get_type( )
> 
> With this change vala has a consistent object model, without
> exceptions (actually the compact classes are exceptions), and open de
> possibility to support another type system with the same level as
> gobject type system, only one consideration must be understand the
> vala programmer when use across type systems: the capabilities of each
> type system
> 
> I would like to receive your opinions.
> 
> PD: I apologize for my bad English, I'm Spanish-speaking 
> 
> -- 
> Juan Luis Paz
> 
> _______________________________________________
> Vala-list mailing list
> Vala-list gnome org
> http://mail.gnome.org/mailman/listinfo/vala-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]