Re: [Vala] how to *not* automagically copy arrays passed to methods?



On 12/20/11 23:58, Luca Bruno wrote:
On Wed, Dec 21, 2011 at 8:54 AM, Matto Marjanovic<maddog mir com>  wrote:
(For posterity's sake, this:
        void bar(uint8[] buffer) {
      buffer[0] = 77;
      baz(() =>  { buffer[0] = 23; });
    }
was supposed to read:
    void bar(uint8[] x) {
      x[0] = 7;
      baz(() =>  { x[0] = 23; });
    }
but got lost in a cut-paste.)

It looks like the presence of the closure is causing the array to get
...
Yes, that's an unfortunate well-known issue that happens with async methods
too, and it's unfortunately hard to fix due to backward-compatibility. You
can workaround it by assigning the array to an unowned local variable
(impossible with async methods).

That is indeed unfortunate.  Before I try to chase it down myself, you
wouldn't happen to know if there is a bug report already outstanding for
this, and what it's number might be?  (I like to document workarounds
code with a reference to the bug being worked around, so that the
workaround can go away when the bug is fixed.)

Is there a list of such issues, and/or a plan for how to deal with them?

Perhaps the thing to do is to provide backward-compatibility flags for
valac --- to turn the bugs back on for those that can't do without them.
It'd be a shame to cripple the language on account of early mistakes.

-m




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