Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Scribble examples fail to use `+` correctly

Đang mở
#376 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Lĩnh vực
documentation

Hướng nghiên cứu

Tái hiện ví dụ Scribble với scribble/examples và macro demo, sau đó kiểm tra scribble-lib/scribble/racket.rkt quanh dòng 1272 cùng cách nó sử dụng syntax-span. So sánh các dạng #%provide được quote và syntax-quote, rồi xác định tại sao phép kết hợp tạo ra #f; hoàn thành khi ví dụ được báo cáo không còn gây ra lỗi vi phạm contract của +.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I'm on 8.10 [cs], the latest Debian, and am running my code using racket-mode. I have a #lang scribble/manual document that depends on scribble/examples. I'll start with the error.

; +: contract violation
;   expected: number?
;   given: #f
; Context (plain; to see better errortrace context, re-run with C-u prefix):
;   /home/sage/.racket/share/pkgs/scribble-lib/scribble/racket.rkt:1272:26 loop
;   /home/sage/.racket/share/pkgs/scribble-lib/scribble/racket.rkt:1272:26 loop
;   /home/sage/.racket/share/pkgs/scribble-lib/scribble/racket.rkt:1168:0 do-syntax-ize
;   /home/sage/.racket/share/pkgs/scribble-lib/scribble/racket.rkt:1272:26 loop
;   /home/sage/.racket/share/pkgs/scribble-lib/scribble/racket.rkt:1272:26 loop
[...]

This @-expression from my code that raises the error. Simpler examples do not reproduce, so let's go with this for now. It appears that the (struct term:ksub term (body) #:transparent) instance fails in this exact composition, where term is just (struct term () #:transparent). I'm omitting other structure definitions to keep this at least somewhat brief.

@demo[
(define (ksub-example . xs)
  (with-syntax ([(x ...) xs])
    (term:ksub-parse
     #'(module #%kernel '#%kernel
         (#%module-begin
          (#%require '#%kernel
                     (for-syntax '#%kernel)
                     (prefix : '#%kernel)
                     (for-syntax (prefix : '#%kernel)))
          x ...)))))

(ksub-example '(#%provide (all-from '#%kernel)))
]

I use this demo macro. Let #:eval be hypothetical.

(define-syntax-rule (demo forms ...)
   (examples #:eval (example-evaluator) forms ...))

If you change '(#%provide (all-from '#%kernel))) to #'(#%provide (all-from '#%kernel))), the error goes away. Since scribble-lib/scribble/racket.rkt:1272:26 makes heavy use of syntax-span, I suspect that location information disappears in some nontrivial compositions of quoted code in syntax templates.

Ngôn ngữ chính
Racket
Star
250
Fork
102
Merge trung bình
11 ngày 9 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của racket/scribble

Tất cả issue của racket/scribble

Issue tương tự

Thêm issue về Documentation

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.