chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Strange problems with args egg


From: Jonathan Chan
Subject: Re: [Chicken-users] Strange problems with args egg
Date: Sun, 04 Aug 2013 00:13:33 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7

Thank you for the help! This is definitely a very interesting language to learn.

On 08/03/2013 09:06 AM, John Cowan wrote:
Jonathan Chan scripsit:

Here is the smallest amount of args-using Chicken that will cause the
problem:

(define-syntax test
   (syntax-rules ()
     ((test)
      (begin
        (define opts (list (args:make-option (h help) #:none "display
        this text" (print "foo"))))
        (write (args:parse (command-line-arguments) opts))))))

[...]

The strange thing is that h and help seem to have turned into ("h390"
"help391"), causing problems.
This is not a Chicken-specific problem, but a general problem
with non-hygienic macros.  You are using the non-hygienic macro
"args:make-option" within a hygienic macro.  The syntax-rules transformer
doesn't know that "h" and "help" are being used literally here (because
it cannot tell what args:make-option does), so it systematically renames
them to avoid collisions.

Is there something I need to change to fix the problem? Sorry for many
misunderstandings.
You can rewrite test as a non-hygienic (explicit renaming or implicit
renaming) macro.


--
Jonathan Chan
address@hidden




reply via email to

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