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 599636 - Declaring string object fails
Declaring string object fails
Status: RESOLVED NOTABUG
Product: vala
Classification: Core
Component: Genie
unspecified
Other Linux
: Normal blocker
: ---
Assigned To: Jamie McCracken
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-10-26 10:28 UTC by Barry Kauler
Modified: 2009-10-26 23:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Barry Kauler 2009-10-26 10:28:13 UTC
I am using vala from git, October 24, 2009.

This simple example used to compile:

init
       var s = new string
       s += "My name is Barry"
       print s

Try to compile, gives this error:

arrays.gs:2.10-2.19: error: `string' does not have a default constructor
       var s = new string
Comment 1 Barry Kauler 2009-10-26 23:19:33 UTC
Ah, it was a bug in older versions of the Vala compiler. As reported to the mail-list:

>> >  I am asking about
>> >
>> >  var s = new string
>> >
>> >  To me, it *does* make sense, but anyway, I am not asking about it's
>> >  merits. I would like to know why it compiled before, not now.
>> >  It looks like quite legal syntax to me, and the compiler was happy
>> >  with it, and if it is now not legal, why not?
>>
>> The syntax is fine, it's just that string does not have a constructor.
>> It used to work because valac did not check for this before (I've
>> recently found the same to be true for Object), whether this should
>> work or not is something I cannot answer.
>
> indeed the fact it no longer works is because that bug/loophole has been
> fixed (this is not a genie bug as it affects vala as well)
>

So, it can be closed.
Thanks for the help.