Re: [Vala] Behavior on null pointers



On Sat, Jan 15, 2011 at 12:23 PM, Thomas Müller <muelletm googlemail com>wrote:

Shouldn't a programming language, that offers exception handling, throw
some kind of null pointer exception?


A lot of languages do, but it's not set in stone.  Vala doesn't for a
variety of reasons.

On top of what's already been written here, know that in Vala there is no
class of exceptions that can be thrown at any time (like Java's Error
exceptions).  If a method can throw an exception, it must be explicitly
declared in the prototype.  For exceptions of the variety of null reference
exceptions, that would mean every method would have to be declared as
throwing an error.  That's not the design of most GObject-based libraries,
including GLib.

-- Jim


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