GNOME Bugzilla – Bug 680595
Working with object bindings without constructor
Last modified: 2014-07-06 04:35:48 UTC
Gir & vapigen generate the following when binding objects without test_new () constructor: test.vapi: public class Test : GLib.Object { [CCode (has_construct_function = false)] public Test (); } The new Test () generated code will use inexisting test_new() method. It would be nice if vala could cope with objects without _new() constructor.
As discussed at GUADEC, there was a bug in the header file. g-ir-scanner and vapigen do not add a constructor to the .vapi if there is no *_new function. Classes without *_new function can be instantiated with Object.new() but there is no syntactic sugar as available in gjs, e.g.. One point we should remember when deciding about possible syntactic sugar is that adding a *_new function later on should not break existing bindings.
Is this bug still valid?
(In reply to comment #2) > Is this bug still valid? We generate [CCode (has_construct_function = false)] protected Test (); So no.