[racket] Unreachable line reached

From: Paulo J. Matos (paulo at matos-sorge.com)
Date: Mon Sep 17 13:19:52 EDT 2012

Hello,

I have a trivial question but I desperately need a spare pair or eyes 
(or another brain).

I have the loop:
         (let loop ([line (read-line in)])
           (when (not (eof-object? line))
             (let ([split-str (string-split line ",")])
               (when (not (= (length split-str) 3))
                 (printf "[1] read-cache fails, unexpected line in cache 
file: ~a, ignoring.~n" line)
                 (loop (read-line in)))
               (let ([path (first split-str)]
                     [modtime (string->number (string-trim (second 
split-str)))]
                     [md5 (string->bytes/utf-8 (string-trim (third 
split-str)))])
                 (when (or (not path) (not modtime) (not md5))
                   (printf "[2] read-cache fails, unexpected line in 
cache file: ~a, ignoring.~n" line)
                   (loop (read-line in)))
                 (when (not modtime)
                   (error "fail")) ;; unreachable?
                 (hash-set! (*cache*) path (cons modtime md5))
                 (loop (read-line in)))))))

This is to read a file that has "<path>, <modification time>, <md5sum>"
Lets for now forget problems with paths which contain ','s, how can the 
program break in (error "fail") if I has just tested for (or (not path) 
(not modtime) (not md5))?

Am I missing something? (error "fail") should be unreachable, right?
-- 
PMatos


Posted on the users mailing list.