Re: [Vala] Question regarding passing a strings as arguments to a method

On 11 July 2011 13:03, Serge Hulne <serge hulne gmail com> wrote:

A string in Vala is a *reference* type [1] and therefore passed by

Not according to the documentation:

Cf Vala tutorial:

"Reference Types

The reference types are all types declared as a class, regardless of
whether they are descended from GLib's Object or not. Vala will ensure
that when you pass an object by reference the system will keep track
of the number of references currently alive in order to manage the
memory for you. The value of a reference that does not point anywhere
is null. More on classes and their features in the section about
object oriented programming."

Actually, string is a classed type, see

It isn't the most convenient class, since strings are used raw, with
no wrapping for extra features (like reference counting etc,) but in
general behaves like other classed types.

That is why I sought to clarify this point


reference. The documentation is correct here, it may just need to
point out clearly that fact.


[1] it is a bit special because it is immutable, and thus copied
whenever there is a new strong reference to it

vala-list mailing list
vala-list gnome org

Phil Housley

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