chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Another define bug and a question


From: Reed Sheridan
Subject: Re: [Chicken-users] Another define bug and a question
Date: Wed, 8 Jun 2005 01:49:49 -0500

On 6/7/05, felix winkelmann <address@hidden> wrote:
> On 6/7/05, Reed Sheridan <address@hidden> wrote:
> > A self-explanatory snippet:
> >
> > #> (define-macro (foo) "foo")
> > #> (foo)
> > "foo"
> > #> (define foo 1)
> > #> foo
> > Error: invalid syntax in macro form: foo
> > #> (foo)
> > "foo"
> > #>
> >
> > That's without the -hygienic flag.  With the -hygienic flag, foo is
> > redefined as 1 as you would expect.
> 
> Macros and procedures live in a different namespace in the
> low-level macro system. The example above is simply wrong,
> but admittedly the error message could be improved.

I don't quite understand.  I thought we only had one namespace in
Scheme, and I was expecting foo to be set to 1, which is in fact what
happens if you use the -hygienic flag.  To make it more clear, what
would a better error message say?

 
> I disabled the calls to `check-arg' in srfi-14.scm since the checks are
> made anyway, albeit a bit deeper inside the library functions. This will
> give less informative error messages, that's true.

I took another look at it - reading the code, it looks like you're right, but:

;;next 2 should raise error
#> (char-set-contains? char-set:digit 3)
#f
#> (%char->latin1 3)
0
;; This definition is from the source
#> (define (%char->latin1 c) (char->integer c))
;; Correct behaviour
#> (char-set-contains? char-set:digit 3)
Error: (char->integer) bad argument type - not a character: 3

%char->latin1 is not hidden like it should be, due to a typo in the
declarations, but I don't understand how that could cause this to
happen.
 
Reed Sheridan




reply via email to

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