Re: [Vala] Impossible to subclass from gio stream classes?



On Thu, Oct 01, 2009 at 14:57:19 +0200, Jiří Zárevúcky wrote:
On Wed, Sep 30, 2009 at 7:46 PM, Jan Hudec <bulb ucw cz> wrote:
On Wed, Sep 30, 2009 at 18:58:54 +0200, Philipp Zabel wrote:
I'd like to subclass GLib.BufferedInputStream.
Vala doesn't like the following construct:

class MyStream : GLib.BufferedInputStream {
    MyStream (GLib.InputStream base_stream) {
        base (base_stream);
    }
}

$ valac mystream.vala --pkg gio-2.0
mystream.vala:3.3-3.20: error: chain up to
`GLib.BufferedInputStream..new' not supported
        base (base_stream);
        ^^^^^^^^^^^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)

Am I doing it wrong? BufferedInputStream has a constructor that takes
one GLib.InputStream.

Short story:
------------

   MyStream (GLib.InputStream _base_stream) {
       base_stream = _base_stream;
   }

Long story:
-----------

[...]
--
                                                Jan 'Bulb' Hudec <bulb ucw cz>

I take it this has changed recently?

It was like this from the begining. It must have been like this, because it's
how GObject library is designed.

Last time I checked constructor chaining worked flawlessly. Is there
any documentation on this new behavior?

It does work. Am I saying it does not? It's just that you can't use
non-default constructors of non-vala classes, because they are not really
there. And you never could, because they were never there.

-- 
                                                 Jan 'Bulb' Hudec <bulb ucw cz>



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