[racket] Typed racket and command line parameters

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Sat Jun 21 03:45:33 EDT 2014

Hi there,
I try to change one of my programs to typed racket and fail because of
errors when dealing with command line arguments.

Here a minimum example:

#lang typed/racket/base

(require racket/cmdline)


(: opt-verbose-mode (Parameterof Boolean))
(define opt-verbose-mode (make-parameter #f))
(: opt-max-size (Parameterof Any))
(define opt-max-size (make-parameter "0"))



(define parms
  (command-line
   #:program "mypgm"
   #:once-each
   [("-v" "--verbose") "Show verbose output" (opt-verbose-mode #t)]
   [("-m" "--max-size") NUM ("Max size." "NUM") (opt-max-size NUM) ]
   ))


(define (myfun)
  (when (opt-verbose-mode)
    (if (> (string->number (opt-max-size)) 0)
        #t
        #f)))


What do I do wrong? Any hint appreciated.

-- 
Thanks,
Manfred





Posted on the users mailing list.