SRFI-37 does not process optinal argument to short option.
R7RS Scheme scripting engine
Status: Beta
Brought to you by:
shirok
Hello.
It looks like Gauche's implementation of SRFI-37 has an issue:
gosh> (use srfi-37)
(args-fold '("-I" "the-argument")
(list (option '(#\I) #f #t
(lambda (opt name arg result)
(and (eqv? name #\I) arg))))
(lambda args (error "unrecognized"))
(lambda args #f)
#f)
#f
But the SRFI requires that "the-argument" be recognized as argument to "-I", since "-I" was defined as having an optional argument.
See that, if the option argument is concatenated with the short option name, Gauche correctly recognizes it:
(args-fold '("-Ithe-argument")
(list (option '(#\I) #f #t
(lambda (opt name arg result)
(and (eqv? name #\I) arg))))
(lambda args (error "unrecognized"))
(lambda args #f)
#f)
(This is supposed to work since -I is the last argument)
Sorry, I forgot to add: the result of the last expression is "the argument", as expected.
That test was taken from Guile.
Thanks for reporting. We'll track this issue at https://github.com/shirok/Gauche/issues/703