[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: #1690: Specializations using "and" (and/or other macros) don't work
From: |
Chicken Trac |
Subject: |
Re: #1690: Specializations using "and" (and/or other macros) don't work properly (was: Specialization breaks "and" macro?) |
Date: |
Tue, 24 Mar 2020 19:18:11 -0000 |
#1690: Specializations using "and" (and/or other macros) don't work properly
--------------------------------+----------------------------
Reporter: sjamaan | Owner: (none)
Type: defect | Status: new
Priority: major | Milestone: 5.4
Component: unknown | Version: 5.2.0
Resolution: | Keywords: specialization
Estimated difficulty: medium |
--------------------------------+----------------------------
Description changed by sjamaan:
Old description:
> [[https://lists.gnu.org/archive/html/chicken-
> hackers/2020-03/msg00012.html|Reported]] by Kon Lovett:
>
> {{{
> cat >matches-prob-test.scm <<'HERE'
> (import scheme)
> (import (chicken irregex))
>
> (define (uses-predicate str)
> (and
> (string? str)
> (irregex-match? '(: "foo") str) ) )
>
> (print "uses-predicate: " (uses-predicate ""))
> HERE
>
> csc ./matches-prob-test.scm
> ./matches-prob-test
> #uses-predicate: #f
>
> csc -specialize ./matches-prob-test.scm
> ./matches-prob-test
> #Error: unbound variable: and
> }}}
>
> Interestingly, this goes all the way back to 4.9.0; in 4.8.0.5 this
> program (with suitable changes for C4) works as expected with
> `-specialize`.
New description:
[[https://lists.gnu.org/archive/html/chicken-
hackers/2020-03/msg00012.html|Reported]] by Kon Lovett:
{{{
cat >matches-prob-test.scm <<'HERE'
(import scheme)
(import (chicken irregex))
(define (uses-predicate str)
(and
(string? str)
(irregex-match? '(: "foo") str) ) )
(print "uses-predicate: " (uses-predicate ""))
HERE
csc ./matches-prob-test.scm
./matches-prob-test
#uses-predicate: #f
csc -specialize ./matches-prob-test.scm
./matches-prob-test
#Error: unbound variable: and
}}}
Interestingly, this goes all the way back to 4.9.0; in 4.8.0.5 this
program (with suitable changes for C4) works as expected with
`-specialize`.
It looks like the `and` that's being complained about is the one in the
`irregex-match?` specialization in `types.db`. This makes sense if the
specialization is the last thing that happens, there's no more macro
expansion step and stuff will break.
--
--
Ticket URL: <https://bugs.call-cc.org/ticket/1690#comment:1>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.