On 23 May 2010 16:12, Peter Bourgon <
peterb...@gmail.com> wrote:
> On Sun, May 23, 2010 at 5:04 PM, roger peppe <
rogp...@gmail.com> wrote:
>> if it really matters that the server stay up,
>
> What possible server can you write where this isn't the case? Strange
> definition of 'server'. Reminds me of Ruby ;)
code started to serve a particular request, such as a CGI script,
is one example. for servers that really need to stay around, there's
often some kind of external monitor that can restart it if necessary.
> If you will put recover traps around even your log printing, then I
> wouldn't like to maintain your code!
this actually raises an interesting style issue: where is
it appropriate to put recovers? i see two acceptable
places: in an outer level loop, to recover from unexpected
runtime panics; and in an inner call, to recover from (and
deal with appropriately) a known possible error.
an example of the latter (into which category i think the
log file example would fall) is in the json code - see
unmarshal() in src/pkg/json/decode.go
> Programmers expect nil pointer dereferences to do Bad Things.
> Programmers don't expect a missing % in a string literal to crash a
> program at runtime, as far as I'm aware.
C crashes if you give a %s with no matching argument.
that's a fairly Bad Thing :-)