Hi meinbg,

> Let's see if this mail gets through:

Yes, perfectly.


> Tcphex is a tcp proxy that gives a realtime hexdump of data sent both ways.
> ...
> All comments appreciated.

Thanks for your contribution! It looks like you did a really good job!
Perhaps you might also want to publish it in the PicoLisp google code
repository?


I must confess that I didn't analyze everything in detail, still allow
me to write some impressions and hints.

"tcphex"
   I don't understand why that such a helper script is necessary. Don't
   the mechanisms described e.g. in the "Scripting" chapter of the
   tutorial work? If the PicoLisp script starts with

      #!/usr/bin/picolisp /usr/lib/picolisp/lib.l

   then no additional shell script would be required.

"getopts.l"
   In a similar way, it seems to me that (getopts) is a little overkill.
   But there are surely situations where it might be extremely useful.

   Using recur/recurse instead of a loop is interesting. I suspect,
   however, that using 'loop' or 'for' would also work.

"tcphex.l"
   Line 91: (out 2 (prinl (pack (rest))))
      'prinl' doesn't need 'pack'. It will also directly output nested
      data: (prinl (rest)) would give the same output.

      Also, calling (rest) is not needed. In general, instead of

         (foo (rest))

      it is more efficient to call

         (pass foo)

      because (rest) builds a list which is not needed thereafter. In
      total the above expression would reduce to

         (out 2 (pass prinl))

   Line 155: (let H (tail 2 (cons "0" (chop (hex Num))))
      The (cons "0" ..) seems to be to guarantee a minimum of two digits
      in the list. Instead, you could use (pad 2 (hex Num)).

   Line 166: (unless (= "Success" (catch '(NIL) (main) "Success"))
      I would recommend '==' here instead of '='. This guarantees that
      there is no conflict with some error string "Success" returned by
      'catch' by some bad chance.

      Even better might be

         (when (catch '(NIL) (nil (main)))

      It is a little shorter, and you would have access to the error
      message returned by 'catch' in the '@' variable.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to