chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1289: getopt-long (value #f) inconsistent with docum


From: Chicken Trac
Subject: [Chicken-janitors] #1289: getopt-long (value #f) inconsistent with documentation
Date: Thu, 26 May 2016 16:30:13 -0000

#1289: getopt-long (value #f) inconsistent with documentation
-------------------------+---------------------
 Reporter:  nxg          |      Owner:
     Type:  defect       |     Status:  new
 Priority:  major        |  Milestone:  someday
Component:  extensions   |    Version:  4.10.x
 Keywords:  getopt-long  |
-------------------------+---------------------
 The documentation for `getopt-long` says that

     (value FLAG [(PROPERTY VALUE) ...])
     If FLAG is #t, the option requires a value;...

 and

     (predicate FUNC)
     If the option accepts a value (i.e. you specified (value #t) for this
 option)...

 These would seem to indicate that `(value #t (predicate ,string))` would
 be acceptable, but the following program fails:

 {{{
 (use getopt-long)

 (define grammar
   `((test (single-char #\t)
           (value #t ;(required "REQ")
                  (predicate ,string?)))))

 (write
  (getopt-long '("my-prog" "-t" "foo")
               grammar))
 (newline)
 }}}

 Result:

 {{{
 % csi getopt-long-demo.scm

 CHICKEN
 (c) 2008-2015, The CHICKEN Team
 (c) 2000-2007, Felix L. Winkelmann
 Version 4.10.0 (rev b259631)
 macosx-unix-clang-x86-64 [ 64bit manyargs dload ptables ]
 compiled 2015-08-04 on yves.more-magic.net (Linux)

 ; loading getopt-long-demo.scm ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/getopt-long.import.so
 ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/chicken.import.so ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/data-
 structures.import.so ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/srfi-1.import.so ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/srfi-13.import.so ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/srfi-14.import.so ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/matchable.import.so ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/lolevel.import.so ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/getopt-long.so ...
 ; loading /Data/tools/chicken-4.10.0/lib/chicken/7/matchable.so ...

 Error: invalid value specification : (#t (predicate #<procedure (string?
 x463)>))

 }}}

 Replacing the `#t` with `(required "REQ")` works as expected.

--
Ticket URL: <http://bugs.call-cc.org/ticket/1289>
CHICKEN Scheme <http://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]