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

2011-07-11 Thread Serge Hulne
It is correct in a sense, but again it is misleading. - A C++ programmer might interpret it as: f(std::string s), which implies a copy, as opposed to: f(std::string s). - A Visual Basic programmer might interpret it as : f(ByVal test As String) which is obviously not what is intended. I am not

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

2011-07-11 Thread Abderrahim Kitouni
Hello, 2011/7/11 Serge Hulne serge.hu...@gmail.com: If one has a look at the C code generated by Vala for the following two examples, it appears that the unowned keyword has no influence on the way the string b (of type gchar*) is passed to f(). In both cases, it is passed as a pointer

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

2011-07-11 Thread Serge Hulne
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

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

2011-07-11 Thread Phil Housley
On 11 July 2011 13:03, Serge Hulne serge.hu...@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

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

2011-07-11 Thread Serge Hulne
All right, But it is a rather odd class indeed then, because: 1) I dont't think it has the value null when unassigned. 2) It derogates to the rule according to which the default behaviour in an assignment between class types is by reference (when a string is assigned to another, the default is

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

2011-07-11 Thread Abderrahim Kitouni
Hello, On 11 يول, 2011 م 05:15, Serge Hulne wrote: All right, But it is a rather odd class indeed then, because: 1) I dont't think it has the value null when unassigned. It does (or at least it should). 2) It derogates to the rule according to which the default behaviour in an assignment

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

2011-07-10 Thread Serge Hulne
The Vala tutorial says: *Parameter Directions* ** *A method in Vala is passed zero or more arguments. The default behaviour when a method is called is as follows: * - *Any value type parameters are copied to a location local to the method as it executes. * - *Any reference type

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

2011-07-10 Thread Гаврилов Максим
Strings are passed by value. To avoid this use unowned keyword. 11.07.2011 1:36 пользователь Serge Hulne serge.hu...@gmail.com написал: The Vala tutorial says: *Parameter Directions* ** *A method in Vala is passed zero or more arguments. The default behaviour when a method is called is as

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

2011-07-10 Thread Serge Hulne
If one has a look at the C code generated by Vala for the following two examples, it appears that the unowned keyword has no influence on the way the string b (of type gchar*) is passed to f(). In both cases, it is passed as a pointer (without duplication). Therefore it seems to me that the Vala