Menu

#75 SRFI-37 does not process optinal argument to short option.

General
open
nobody
None
5
2020-07-06
2020-07-03
No

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)

Discussion

  • Jeronimo Pellegrini

    Sorry, I forgot to add: the result of the last expression is "the argument", as expected.

    That test was taken from Guile.

     
  • Shiro Kawai

    Shiro Kawai - 2020-07-06

    Thanks for reporting. We'll track this issue at https://github.com/shirok/Gauche/issues/703

     

Log in to post a comment.

MongoDB Logo MongoDB