Re: [Vala] Why do regular reference types leak null?

2009-08-22 Thread Jan Hudec
Magentus magen...@... writes: I see two problems with not allowing nulls in regular variables. One is that a variable starts its life as null (or even worse, uninitialised), and could be assigned to another variable or returned No, it can't. Vala implements the same definite assignment rules

Re: [Vala] Why do regular reference types leak null?

2009-08-22 Thread Yu Feng
On Sat, 2009-08-15 at 00:12 +0200, Jiří Zárevúcky wrote: On 08/14/2009 10:57 PM, Sam Danielson wrote: Why shouldn't they be null? IMO, it would just add much more trouble. Checking nulls is responsibility of the programmer. That is consistent with every other language I know, including

Re: [Vala] Why do regular reference types leak null?

2009-08-16 Thread Magentus
On Fri, 14 Aug 2009 13:57:01 -0700, Sam Danielson samdaniel...@gmail.com wrote: I don't think I understand what you mean. For reference types, there is no technical difference between Foo and Foo?, except as the marking of arguments and return values that must not be null (that's checked in

Re: [Vala] Why do regular reference types leak null?

2009-08-16 Thread Jiří Zárevúcky
On 08/16/2009 09:28 PM, Magentus wrote: Out of interest, has there been any discussion about actually making Vala a GCC front-end? GCC already has the mechanism to do most of this... I suppose it's useful being able to convert it to C, and then distribute that so it can be compiled on

Re: [Vala] Why do regular reference types leak null?

2009-08-14 Thread Jiří Zárevúcky
On 08/14/2009 02:48 AM, Sam Danielson wrote: The following code compiles with no warnings with the 0.7.3 compiler and segfaults at runtime. I understand that nullable types can be null but why are regular reference types allowed to be null? I noticed that if the return type of make_foo is

Re: [Vala] Why do regular reference types leak null?

2009-08-14 Thread Jiří Zárevúcky
On 08/14/2009 10:57 PM, Sam Danielson wrote: Why shouldn't they be null? IMO, it would just add much more trouble. Checking nulls is responsibility of the programmer. That is consistent with every other language I know, including dynamic ones, C#, Java, etc. Perhaps I am misunderstanding

Re: [Vala] Why do regular reference types leak null?

2009-08-14 Thread Sam Danielson
'valac --help' shows an option called '--enable-non-null-experimental' which might be what you want. I have tried it, but at the moment it complains about 'glib-2.0.vapi', because many parameters with 'null' as default value are not marked as nullable. Excellent. I haven't looked at the Vala

Re: [Vala] Why do regular reference types leak null?

2009-08-14 Thread Sam Danielson
2009/8/14 Jiří Zárevúcky zarevucky.j...@gmail.com: On 08/14/2009 10:57 PM, Sam Danielson wrote: Perhaps I am misunderstanding the purpose of nullable types. The Vala tutorial explains, By default, Vala will make sure that all reference point to actual objects. As I understand, the whole point

[Vala] Why do regular reference types leak null?

2009-08-13 Thread Sam Danielson
The following code compiles with no warnings with the 0.7.3 compiler and segfaults at runtime. I understand that nullable types can be null but why are regular reference types allowed to be null? I noticed that if the return type of make_foo is changed from Foo? to Foo I at least get a warning.