[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] #891: args egg: can't use an option called "name"
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] #891: args egg: can't use an option called "name" |
Date: |
Mon, 30 Jul 2012 18:56:11 -0000 |
#891: args egg: can't use an option called "name"
------------------------+---------------------------------------------------
Reporter: dreamtime | Owner:
Type: defect | Status: new
Priority: major | Milestone: 4.8.0
Component: extensions | Version: 4.7.x
Keywords: |
------------------------+---------------------------------------------------
When using the args egg, trying to use an option called "name" fails
because of a conflict with the args egg's own internal "name" variable.
From the args egg documentation: "BODY is an option-processor as defined
in SRFI 37, and has access to the variables OPT (the current #<option>),
NAME (the option name) and ARG (argument value or #f)."
At line 12 in the code example given below, everything works as intended,
with the "name" variable being set to "foo" when the program is called as:
./myprogram.csi --name=foo
But after line 19, the "name" variable is empty again.
If the "name" variable is changed from "name" to anything else, like
"xyz", it works.
{{{
01 (define name "")
02
03 ...
04
05 (define opts
06 (list (args:make-option
07 ...
08 (args:make-option
09 (n name)
10 (required: "NAME")
11 "description of this option goes here"
12 (set! name arg))
13 ...)
14
15 (define (get-args)
16 (receive (options operands)
17 (args:parse (command-line-arguments)
18 opts
19 #:unrecognized-proc unrecognized-option)
20 (check-args options operands)
21 (values name foo bar baz)))
}}}
--
Ticket URL: <http://bugs.call-cc.org/ticket/891>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] #891: args egg: can't use an option called "name",
Chicken Trac <=