Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Scribble examples fail to use `+` correctly

オープン
#376 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
領域
documentation

調査の方向性

Reproduce the Scribble example with scribble/examples and the demo macro, then inspect scribble-lib/scribble/racket.rkt around line 1272 and its use of syntax-span. Compare the quoted and syntax-quoted #%provide forms and determine why the composition produces #f; done means the reported example no longer raises the + contract violation.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Racket
スター
251
フォーク
101
平均マージ
6日 22時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

racket/scribble のほかの issue

racket/scribble の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。