大抵のプログラミング言語では名前解決はほとんど空気みたいなものだ。 いちいち意識したりしない。 言語によってはルールが複雑だったり奇妙だったりすることもあるが、あくまで言語に組込みの機能であって、カスタマイズの余地はあまりないのが普通だ。 その中で Scheme の datum->syntax は特異な機能だと思う。 スコープの規則を曲げることが出来る。 以前にスコープの規則を曲げる例として let/scope というマクロを書いた。 再掲する。 (define-syntax let/scope (lambda(x) (syntax-case x () ((k scope-name body ...) #'(let-syntax ((scope-name (lambda(x) (syntax-case x () ((_ b (... ...)) #`(begin #,@(datum->sy
何度か取り上げたような気がするが、 Scheme のマクロ機構における datum->syntax の第一引数の意味が未だによくわからない。 あらためて規格を読んでみることにした。 (datum->syntax template-id datum) template-id はテンプレート識別子であり、datum はデータ値でなければならない。 この手続きは template-id と同一の文脈情報をもつ datum の構文オブジェクト表現を返す。 このとき、この構文オブジェクトは template-id が挿入されたのと同時にコードに挿入されたかのようにあつかわれる。 ここで「文脈情報 (contextual information)」という言葉がよくわからない。 更に続きの文を見ると… datum->syntax をつかうと、その識別子がもともと入力にあったかのようにあつかわれる暗黙の識
The Why of Y February 3, 2001 1 The Why of Y Richard P. Gabriel Lucid, Inc. and Stanford University Did you ever wonder how Y works and how anyone could ever have thought of it? In this note I’ll try to explain to you not only how it works, but how someone could have invented it. I’ll use Scheme notation because it is easier to understand when functions passed as arguments are being applied. The p
Mob Software: The Erotic Life of Code [html] [pdf] This essay was first presented by Richard P. Gabriel at the ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications on October 19, 2000, in Minneapolis, Minnesota, USA. Musical interspersions are from the collection of Ron Goldman. Worse Is Better [html] One of the better known pieces I wrote is affectionately called "W
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く