Re: [Vala] Deriving classes from GLib.Thread



Yes, it's invalid because you inherit from compact class.

However, you pointing up an issue!
Shell ValaC give a "normal" error on inheritance?
e.g.:
"MThread.vala:1.1-3.18: error: class `MThread<T>' can't inherit from class `GLib.Thread',
since it's compact.
class MThread<T> : GLib.Thread<T>
                                        ^^^^^^^^^^^"
- Tal


Date: Tue, 30 Apr 2013 10:44:49 -0400
From: andrew benton675 gmail com
To: richard wiedenhoeft gmail com
CC: vala-list gnome org
Subject: Re: [Vala] Deriving classes from GLib.Thread

I believe that the problem that you are having is due to the fact that 
GLib.Thread<T> is a compact class.  When classes are compact, it means 
that you cannot inherit from them.

For information on compact classes, look here: 
https://live.gnome.org/Vala/ReferenceHandling#Memory_management_for_compact_classes_without_reference_counting
 


On 4/30/2013 6:43 AM, Richard Wiedenhöft wrote:
Hi,

I am trying to add some functionality (e.g. an is_alive-method) to the
GLib.Thread class, but with the following code:

class MThread<T> : GLib.Thread<T> {
         public MThread(string? name, ThreadFunc<T> func) {
                 base(name, func);
         }

         public MThread.try(string? name, ThreadFunc<T> func) throws Error {
                 base.try(name, func);
         }
}

I get the following error:

MThread.vala:3.3-3.18: error: chain up to `GLib.Thread' not supported
         base(name, func);
         ^^^^^^^^^^^^^^^^
MThread.vala:7.3-7.10: error: The name `try' does not exist in the
context of `GLib.Thread<T>'
         base.try(name, func);
         ^^^^^^^^
MThread.vala:6.2-6.19: error: unable to chain up to private base constructor
     public MThread.try(string? name, ThreadFunc<T> func) throws Error {
     ^^^^^^^^^^^^^^^^^^
Compilation failed: 3 error(s), 0 warning(s)

I found a similar issue in
https://mail.gnome.org/archives/vala-list/2009-October/msg00000.html but
it is not helping me very much. It just gives me
the idea, that my problem is something that is not as easily solved as
it sounds...

Thanks for any help in advance




_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list

_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
                                          


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