POV-Ray : Newsgroups : povray.off-topic : Call of Duty servers run Erlang : Re: Call of Duty servers run Erlang Server Time
29 Jul 2024 16:32:24 EDT (-0400)
  Re: Call of Duty servers run Erlang  
From: Warp
Date: 25 Jul 2011 09:42:52
Message: <4e2d72db@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> >    I wonder if something similar ever happens with the "safer" programming
> > languages (eg. you get a "null pointer exception" or some other similar
> > error and have absolutely no idea why, and no debugging tool is helping).

> In Java, accessing a null pointer would throw an exception, which (if 
> nothing else) will dump a stack trace to stderr.

  But if the null pointer is accessed in the depths of some obscure system
library which gets called by the main runloop of the program (rather than
being directly called by your code), you might end up in a situation where
the stack trace is completely unhelpful and you have no idea whatsoever
where that null pointer is coming from in your code (which might happen if
you are not using that precise system library directly, but it's a library
used by a library used by a library which you are using, but you don't know
what this chain might be, as the implementation of the library you are using
is hidden behind its public interface).

> In Haskell, accessing a null pointer would... be quite impressive, 
> actually. Given that the core language itself has no notion of "pointer" 
> nor what it means to be "null".

  Well, I did say "or some other similar error".

> Probably the closest equivalent is the "head []" error. If some function 
> was expecting a list of data, but at runtime that list happens to be 
> empty, then the program prints "head []" to stderr and halts. [Unless 
> you wrote some exception handling code, of course.]

> Good luck figuring out where in the entire program the problem actually 
> resides. What's that? Bracket the problem parts with print statements? 
> Ah, but perhaps you're forgetting; Haskell does not execute code in the 
> order written, and printing is only permitted from the IO monad.

> Yes, there /is/ a debugger. No, it will /not/ give you a stack trace.

  So how is that problem usually solved? "Just review the entirety of your
code and try to find the bug"?

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.