El 20/01/10 23:42, Sam Wilson escribió:
>> Date: Wed, 20 Jan 2010 23:23:11 +0100
>> From: [email protected]
>> To: [email protected]
>> Subject: Re: [Vala] Proper Syntax for Array of Nullable Strings
>>
>> Jiří Zárevúcky wrote:
>>> tecywiz121 píše v St 20. 01. 2010 v 16:49 -0500:
>>>> I am just wondering if it is possible to have an array of nullable
>>>> strings, and if so, what is the proper syntax?
>>>>
>>>> Sam
>>>>
>>>
>>> I believe array of class type can always contain nulls. Or am I
>>> mistaken? 
>>
>> Only without --enable-experimental-non-null.
>>
>> However, this one fails with --enable-experimental-non-null:
>>
>> ----------------------------------------------------------------------
>> void main () {
>>      string?[] a = new string?[10];
>> }
>> ----------------------------------------------------------------------
>> demo.vala:2.26-2.26: error: syntax error, expected ( or [
>>      string?[] a = new string?[10];
>>                              ^
>> Compilation failed: 1 error(s), 0 warning(s)
>> ----------------------------------------------------------------------
>>
>>
>> And this one as well:
>>
>> ----------------------------------------------------------------------
>> void main () {
>>      string?[] a = new string[10];
>> }
>> ----------------------------------------------------------------------
>> demo.vala:2.12-2.29: error: Assignment: Cannot convert from `string[]'
>> to `string?[]'
>>      string?[] a = new string[10];
>>                ^^^^^^^^^^^^^^^^^^
>> Compilation failed: 1 error(s), 0 warning(s)
>> ----------------------------------------------------------------------
>>
>> I think the first case should succeed. The latter case seems to fail
>> rightly.
>>
>>
>> Best regards,
>>
>> Frederik
> 
> 
>>
> 
> Does this qualify as a bug?  Because as it stands now, I cannot define an 
> array of nullable strings (or floats or anything else for that matter)
> 
> another problem I am having a hard time wrapping my head around is whether or 
> not
> 
> 
> 
> string?[] a = new string?[10];
> 
> 
> 
> would define an nullable array of strings, or an array of nullable strings. 

I agree with Frederik here.


>  Is it possible to define a nullable array of nullable strings? How?

However, I don't agree with Frederik here, because I think you cannot
and vala shouldn't let you in the future (in case someone thinks it's a
limitation) because, as far as I know, in C# for example an array can
already be null, so making it nullable is non-sense.

        Andrés

-- 

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to