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 623856 - Vala have no support to concatenate arrays
Vala have no support to concatenate arrays
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Arrays
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
: 760724 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-07-08 16:47 UTC by pancake
Modified: 2018-05-22 13:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description pancake 2010-07-08 16:47:38 UTC
In Vala you can do:

var foo = new uint8[10];
foo += 8;

which resizes the array and adds a single value.

But you can't do the same with an array of the same type:

var foo = new uint8[10];
var bar = new uint8[10];
foo += bar;

Given error is:

error: Incompatible operand
error: Assignment: Invalid callback assignment attempt
Comment 1 Julian Andres Klode 2010-07-16 19:32:34 UTC
(In reply to comment #0)
> In Vala you can do:
> 
> var foo = new uint8[10];
> foo += 8;
> 
> which resizes the array and adds a single value.
> 
> But you can't do the same with an array of the same type:
> 
> var foo = new uint8[10];
> var bar = new uint8[10];
> foo += bar;
> 
> Given error is:
> 
> error: Incompatible operand
> error: Assignment: Invalid callback assignment attempt

That would be bad anyway, as the += operator would have two different semantics, appending and concatenating.
Comment 2 zarevucky.jiri 2010-07-21 18:43:13 UTC
In my opinion, the usage of += for appending is wrong anyway.
Why not just add a bunch of methods to arrays? .append() and .concat() would do nicely.
Comment 3 Michael 'Mickey' Lauer 2018-02-26 08:01:21 UTC
*** Bug 760724 has been marked as a duplicate of this bug. ***
Comment 4 GNOME Infrastructure Team 2018-05-22 13:40:47 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/116.