Re: [Vala] Problem with references



Jürg Billeter schrieb:
On Fre, 2006-08-25 at 18:16 +0200, Dominique Würtz wrote:
Jürg Billeter schrieb:
In that concrete case it would probably be best to just mark
Cairo.Matrix as a reference-type, so it will always be passed by
reference. That would make it impossible to ever pass it by value,
though. Do you see a problem with that or shall I change Cairo.Matrix as
afore said?

No, I didn't find any API which requires passing by value so it should be ok, however, there should be the possibility to make a copy of the struct. Maybe a default copy constructor for ref types a la

Cairo.Matrix a;
Cairo.Matrix b = new Cairo.Matrix(b);

would be the way to go?

Not sure yet, as there is no overloading and there could be a default
construction method in the struct. Maybe something like a.copy () or
a.dup () would be better.
I'd vote for a.copy() since it seems to be the name most commonly used in GLib (g_boxed_copy, ...).

Dominique

Jürg






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