bugMIT/GNU Scheme - Bugs: bug #66636, Unable to parse define-library...

 
 

bug #66636: Unable to parse define-library with include-shared in non mit-scheme cond-expand path

Submitter:  Retropikzel <retropikzel>
Submitted:  Fri 03 Jan 2025 02:58:20 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  cph Originator Name: 
Open/Closed:  Open
Keywords: 
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 04 Jan 2025 06:44:31 AM UTC, comment #1: 

Currently the define-library parser recursively parses/validates all cond-expand branches before testing the condition.  In order to fix this the define-library parser either has to eagerly test the condition, or lazily parse the branches.

Taylor R. Campbell <riastradh>
Group Member
Fri 03 Jan 2025 02:58:20 PM UTC, original submission:  

Given code:

(define-library
  (srfi 39)
  (cond-expand
    (chibi (import (chibi)))
    (racket (import (scheme base)))
    (stklos (import (except (scheme base) make-parameter parameterize)
                    (only (stklos) %find-macro-clause)))
    (else (import (except (scheme base) make-parameter parameterize))))
  (export make-parameter parameterize)
  (cond-expand
    (mit-scheme (include "39.scm"))
    (foment (include "39.scm"))
    (chibi (include-shared "39/param")
           (cond-expand
             (threads (include "39/syntax.scm"))
             (else (include "39/syntax-no-threads.scm"))))
    (racket (begin #t))
    (else (include "39.scm"))))

Mit-scheme errors with:

;Unable to parse define-library form: (define-library (srfi 39) (cond-expand (chibi (import (chibi))) (racket (import (scheme base))) (stklos (import (except ... make-parameter parameterize) (only ... %find-macro-clause))) (else (import (except ... make-parameter parameterize)))) (export make-parameter parameterize) (cond-expand (mit-scheme (include "39.scm")) (foment (include "39.scm")) (chibi (include-shared "39/param") (cond-expand (threads ...) (else ...))) (racket (begin #t)) ...))
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.

If I comment out (include-shared "39/param") then there is no error, but obiously the library then does not work on Chibi.

Other R7RS Scheme implementations load the library fine.

Retropikzel <retropikzel>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by riastradh (Posted a comment)
  • -email is unavailable- added by retropikzel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-01-04 riastradh Assigned toNone cph

    Back to the top

    Powered by Savane 3.15-4cd8.
    Corresponding source code