After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 680595 - Working with object bindings without constructor
Working with object bindings without constructor
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-25 15:20 UTC by Marc-Andre Lureau
Modified: 2014-07-06 04:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Marc-Andre Lureau 2012-07-25 15:20:10 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.
Comment 1 Jürg Billeter 2012-08-02 13:11:00 UTC
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.
Comment 2 Zeeshan Ali 2014-01-30 21:39:38 UTC
Is this bug still valid?
Comment 3 Evan Nemerson 2014-07-06 04:35:48 UTC
(In reply to comment #2)
> Is this bug still valid?

We generate

    [CCode (has_construct_function = false)]
    protected Test ();

So no.