| 1 |
@node Introduction, Concepts, Top, Top |
| 2 |
@chapter Introduction |
| 3 |
@c NODE はじめに |
| 4 |
|
| 5 |
@c EN |
| 6 |
This is a users' guide and reference manual of |
| 7 |
the Gauche Scheme. |
| 8 |
Here I tried to describe the implementation precisely, |
| 9 |
sometimes referring to background design choices. |
| 10 |
@c JP |
| 11 |
本書はGauche Schemeに関する、ユーザのためのガイドと |
| 12 |
リファレンスです。なるべくGaucheの実装を正確に記述することを |
| 13 |
目的として、時には背景となる設計上の選択も含めて説明しています。 |
| 14 |
@c COMMON |
| 15 |
|
| 16 |
@c EN |
| 17 |
The target readers are those who already know Scheme and |
| 18 |
want to write useful programs in Gauche. |
| 19 |
For those who are new to Scheme, it'll be easier to start |
| 20 |
from some kind of tutorial. I'm planning to write one. |
| 21 |
@c JP |
| 22 |
したがって、既にSchemeを知っていてGaucheの全機能を活用して |
| 23 |
プログラムを書きたいという読者を対象にしています。 |
| 24 |
Schemeに触れるのが初めての読者は、何らかのチュートリアルを併用すると |
| 25 |
良いでしょう。私もいずれチュートリアルめいたものを書くつもりです。 |
| 26 |
@c COMMON |
| 27 |
|
| 28 |
@c EN |
| 29 |
This manual only deals with Scheme side of things. Gauche has |
| 30 |
another face, a C interface. Details of it will be discussed |
| 31 |
in a separate document. See @file{gauche-dev.texi} in the source |
| 32 |
distribution for the work-in-progress of such document. |
| 33 |
Those who want to use Gauche as an embedded language, or want |
| 34 |
to write an extension, need that volume. |
| 35 |
@c JP |
| 36 |
このマニュアルでは、GaucheのScheme言語としての面のみを扱います。 |
| 37 |
GaucheはC言語から呼べる汎用リスト処理ライブラリとしての側面も持っていますが、 |
| 38 |
それは別ドキュメントで解説されます。配布ソース中の@file{gauche-dev.texi}に |
| 39 |
書きかけのドキュメントがあります。 |
| 40 |
Gaucheを組み込み言語として使いたい、 |
| 41 |
もしくはGaucheをC言語で拡張したいという読者はそのドキュメントが必要となります。 |
| 42 |
@c COMMON |
| 43 |
|
| 44 |
@c EN |
| 45 |
For the Scheme side, I tried to make this manual self-contained |
| 46 |
for the reader's convenience, i.e. as far as you want to look up |
| 47 |
Gauche's features you don't need to refer to other documents. |
| 48 |
For example, description of functions defined in the standard |
| 49 |
documents are included in this manual, instead of saying |
| 50 |
``see the standard document''. However, this document is not a verbatim |
| 51 |
copy of the standard documents; sometimes I omit detailed |
| 52 |
discussions for brevity. |
| 53 |
I put pointers to the original documents, so please consult them if you |
| 54 |
need to refer to the standards. |
| 55 |
@c JP |
| 56 |
Scheme言語としての側面に関しては、なるべくこのマニュアル一冊でリファレンスとしての |
| 57 |
用が足りるように記述しました。標準に定められている関数でも、こちらのマニュアルだけで |
| 58 |
使うのに必要な事項を知ることができます。但し、このマニュアルは標準文書の替わりには |
| 59 |
なりません。記述を短くするために理論的な背景などは省略してあります。 |
| 60 |
オリジナルのドキュメントへのポインタを参考文献の項に上げておきましたので、 |
| 61 |
必要に応じて参照して下さい。 |
| 62 |
@c COMMON |
| 63 |
|
| 64 |
@c EN |
| 65 |
If you're reading this document off-line, you may find the most |
| 66 |
recent version on the web: |
| 67 |
@c JP |
| 68 |
もしあなたがこのマニュアルをオフラインで読んでいるなら、 |
| 69 |
時々下記のURLをチェックしてみて下さい。更新があるかもしれません。 |
| 70 |
@c COMMON |
| 71 |
@example |
| 72 |
@uref{https://practical-scheme.net/gauche/}. |
| 73 |
@end example |
| 74 |
|
| 75 |
@c JP |
| 76 |
なお、本マニュアルの日本語版製作には、 |
| 77 |
佐藤 誠 氏、山下 伸夫 氏の協力を頂きました。 |
| 78 |
@c COMMON |
| 79 |
|
| 80 |
@menu |
| 81 |
* Overview of Gauche:: |
| 82 |
* Notations:: |
| 83 |
@end menu |
| 84 |
|
| 85 |
@node Overview of Gauche, Notations, Introduction, Introduction |
| 86 |
@section Overview of Gauche |
| 87 |
@c NODE Gaucheの概要 |
| 88 |
|
| 89 |
@c EN |
| 90 |
Gauche is a Scheme script engine; it reads Scheme programs, |
| 91 |
compiles it on-the-fly and executes it on a virtual machine. |
| 92 |
Gauche conforms the language standard |
| 93 |
"Revised^7 Report on the Algorithmic Language Scheme" |
| 94 |
(@uref{https://standards.scheme.org/official/r7rs.pdf}), |
| 95 |
and supports various common libraries defined in SRFIs |
| 96 |
(@uref{https://srfi.schemers.org}). |
| 97 |
@c JP |
| 98 |
GaucheはScheme言語のスクリプトエンジンです。 |
| 99 |
Schemeプログラムを読み込み、直ちにコンパイルして仮想マシンで実行します。 |
| 100 |
Scheme言語の標準である、"Revised^7 Report on the Algorithmic Language Scheme" |
| 101 |
(@uref{https://standards.scheme.org/official/r7rs.pdf}) |
| 102 |
に準拠しています。また、SRFI |
| 103 |
(@uref{https://srfi.schemers.org}) に規定されている数多くのライブラリを |
| 104 |
サポートしています。 |
| 105 |
@c COMMON |
| 106 |
|
| 107 |
@c EN |
| 108 |
The goal of Gauche is to provide a handy tool for |
| 109 |
programmers and system administrators to handle |
| 110 |
daily works conveniently and efficiently in the production environment. |
| 111 |
@c JP |
| 112 |
Gaucheは、プログラマやシステム管理者がこなす日常の雑事を |
| 113 |
効率よくSchemeで書けるようにすることを目的として設計されています。 |
| 114 |
@c COMMON |
| 115 |
|
| 116 |
@c EN |
| 117 |
There are lots of Scheme implementations available, and each |
| 118 |
of them has its design emphasis and weaknesses. Gauche is |
| 119 |
designed with emphasis on the following criteria. |
| 120 |
@c JP |
| 121 |
世の中には多くのSchemeの実装がありますが、 |
| 122 |
それぞれの実装には長所と短所があります。 |
| 123 |
Gaucheが長所とするべく重点を置いているのは次のようなポイントです。 |
| 124 |
@c COMMON |
| 125 |
|
| 126 |
@table @b |
| 127 |
@c EN |
| 128 |
@item Quick startup |
| 129 |
@c JP |
| 130 |
@item 立ち上りが速いこと |
| 131 |
@c COMMON |
| 132 |
@c EN |
| 133 |
One of the situation Gauche is aiming at is in the production |
| 134 |
environment, where you write ten-lines throw-away script that |
| 135 |
may invoked very frequently. This includes CGI scripts as well. |
| 136 |
Gauche provides frequently used common features as a part of rich built-in |
| 137 |
functions or precompiled Scheme libraries that can be loaded very quickly. |
| 138 |
@c JP |
| 139 |
Gaucheが想定している用途のひとつは、プロダクション環境でちょろっと |
| 140 |
10行スクリプトをでっちあげて、それが非常に頻繁に呼ばれるようなケースです。 |
| 141 |
CGIスクリプトなどもそうです。 |
| 142 |
Gaucheは頻繁に使われる共通の機能については、豊富な組み込み関数として、 |
| 143 |
あるいはプリコンパイルされ素早くロードできるSchemeライブラリとして提供しています。 |
| 144 |
@c COMMON |
| 145 |
|
| 146 |
@c EN |
| 147 |
@item Fully utilizing multi-core |
| 148 |
@c JP |
| 149 |
@item マルチコアの完全な活用 |
| 150 |
@c COMMON |
| 151 |
@c EN |
| 152 |
Gauche supports native threads on most platforms. |
| 153 |
The internals are fully aware of preemptive/concurrent threads |
| 154 |
(that is, no ``giant global lock''), |
| 155 |
so that you can utilize multiple cores on your machine. |
| 156 |
@c JP |
| 157 |
Gaucheは多くのプラットフォームでネイティブスレッドをサポートしています。 |
| 158 |
内部は全てプリエンプティブな並行スレッドを意識してかかれており |
| 159 |
(つまり、「巨大なひとつのロック」はありません)、 |
| 160 |
複数のコアを存分に活用できるようになっています。 |
| 161 |
@c COMMON |
| 162 |
|
| 163 |
@c EN |
| 164 |
@item Multibyte strings |
| 165 |
@c JP |
| 166 |
@item マルチバイト文字列 |
| 167 |
@c COMMON |
| 168 |
@c EN |
| 169 |
We can no longer live happily in ASCII-only or 1-byte-per-character world. |
| 170 |
The practical language implementations are required to handle |
| 171 |
multibyte (wide) characters. |
| 172 |
Gauche supports multibyte strings natively, providing robust and |
| 173 |
consistent support than @i{ad hoc} library-level implementation. |
| 174 |
@xref{Multibyte strings}, for details. |
| 175 |
@c JP |
| 176 |
文字列が1バイトキャラクタのみを扱っていれば良かった時代は過ぎ去りました。 |
| 177 |
現代のプログラミングシステムは、様々なエンコーディングによるマルチバイト文字/文字列を |
| 178 |
自然に扱える必要があります。 |
| 179 |
Gaucheは内部的に文字列を全て、コンパイル時に選択したエンコーディングの |
| 180 |
マルチバイト文字列として扱います。後から付け足したライブラリレベルでの |
| 181 |
マルチバイト文字列のサポートよりも、一貫性がありロバストな文字列操作が可能になっています。 |
| 182 |
詳しくは@ref{Multibyte strings}を参照してください。 |
| 183 |
@c COMMON |
| 184 |
|
| 185 |
@c EN |
| 186 |
@item Integrated object system |
| 187 |
@c JP |
| 188 |
@item 統合されたオブジェクトシステム |
| 189 |
@c COMMON |
| 190 |
@c EN |
| 191 |
A powerful CLOS-like object system with MetaObject protocol |
| 192 |
(mostly compatible with STklos and Guile) is provided. |
| 193 |
@c JP |
| 194 |
CLOSライクなメタオブジェクトプロトコルを備えた強力なオブジェクトシステム |
| 195 |
が組み込んであります。STklosやGuileのオブジェクトシステムとかなり互換性があります。 |
| 196 |
@c COMMON |
| 197 |
|
| 198 |
@c EN |
| 199 |
@item System interface |
| 200 |
@c JP |
| 201 |
@item システムインタフェース |
| 202 |
@c COMMON |
| 203 |
@c EN |
| 204 |
Although Scheme abstracts lots of details of the machine, |
| 205 |
sometimes you have to bypass these high-level layers and |
| 206 |
go down to the basement to make things work. |
| 207 |
Gauche has built-in support of most of POSIX.1 system calls. |
| 208 |
Other modules, such as networking module, usually provide |
| 209 |
both high-level abstract interface and low-level interface |
| 210 |
close to system calls. |
| 211 |
@c JP |
| 212 |
Schemeは計算機の詳細の多くを抽象化しますが、プログラムを書いていると、 |
| 213 |
それらの高レベル層をバイパスして地下室に降りて作業しなければならないような時が |
| 214 |
あります。GaucheはPOSIX.1システムコールのほとんどを組み込みでサポートします。 |
| 215 |
また、ネットワーキングモジュールなど他のシステム関連モジュールは通常、 |
| 216 |
高レベルの抽象的なインタフェースと低レベルのシステムコールに近いインタフェースを |
| 217 |
両方提供します。 |
| 218 |
@c COMMON |
| 219 |
|
| 220 |
@c EN |
| 221 |
@item Enhanced I/O |
| 222 |
@c JP |
| 223 |
@item 強化された入出力 |
| 224 |
@c COMMON |
| 225 |
@c EN |
| 226 |
No real application can be written without dealing with I/O. |
| 227 |
Scheme neatly abstracts I/O as a port, but defines least operations on it. |
| 228 |
Gauche uses a port object as a unified abstraction, providing |
| 229 |
utility functions to operate on the underlying I/O system. |
| 230 |
@xref{Input and output}, for the basic I/O support. |
| 231 |
@c JP |
| 232 |
本物のアプリケーションはI/O無しでは成り立ちません。 |
| 233 |
SchemeはI/Oをポートとして簡潔に抽象化していますが、 |
| 234 |
標準のSchemeには最低限の操作しか定義されていません。 |
| 235 |
Gaucheはポートオブジェクトを入出力のための統合された抽象化オブジェクトと考え、 |
| 236 |
それを通して下位のI/Oシステム層にアクセスするユーティリティ関数を提供しています。 |
| 237 |
@ref{Input and output}を参照して下さい。 |
| 238 |
@c COMMON |
| 239 |
|
| 240 |
@c EN |
| 241 |
@item Extended language |
| 242 |
@c JP |
| 243 |
@item 拡張された言語 |
| 244 |
@c COMMON |
| 245 |
@c EN |
| 246 |
Gauche is not just an implementation of Scheme; it has some |
| 247 |
language-level enhancements. For example, @emph{lazy sequences} |
| 248 |
allows you to have lazy data structures that behaves as if |
| 249 |
they're ordinary lists (except that they're realized lazily). |
| 250 |
It is different from library-level lazy structure implementation such as |
| 251 |
streams (SRFI-41), in a sense that you can use any list-processing |
| 252 |
procedures on lazy sequences. It enables programs to use |
| 253 |
lazy algorithms more liberally. |
| 254 |
@c JP |
| 255 |
Gaucheは単なるScheme実装というだけでなく、言語レベルでいくつかの拡張が施されています。 |
| 256 |
例えば、@emph{遅延シーケンス}によって、あたかもそれが(遅延して実体化される点を除いて) |
| 257 |
普通のリストであるかのように振るまう遅延データ構造を扱うことが可能になります。 |
| 258 |
あらゆるリスト処理を使用できるという意味で、遅延シーケンスは、 |
| 259 |
例えばストリーム(SRFI-41)のようにライブラリレベルで |
| 260 |
実装した遅延構造とは異なります。 |
| 261 |
これによって、遅延アルゴリズムをよりふんだんに使用したプログラミングが可能になります。 |
| 262 |
@c COMMON |
| 263 |
@end table |
| 264 |
|
| 265 |
|
| 266 |
@node Notations, , Overview of Gauche, Introduction |
| 267 |
@section Notations |
| 268 |
@c NODE 表記について |
| 269 |
|
| 270 |
@menu |
| 271 |
* Entry format:: |
| 272 |
* Names and namespaces:: |
| 273 |
@end menu |
| 274 |
|
| 275 |
@node Entry format, Names and namespaces, Notations, Notations |
| 276 |
@subsection Entry format |
| 277 |
@c NODE 項目の形式 |
| 278 |
|
| 279 |
@c EN |
| 280 |
In this manual, each entry is represented like this: |
| 281 |
|
| 282 |
@deftp {Category} foo arg1 arg2 |
| 283 |
[spec]@{module@} Description of foo @dots{} |
| 284 |
@end deftp |
| 285 |
@c JP |
| 286 |
このマニュアルでは、各項目は次のようなフォーマットで表記されています。 |
| 287 |
|
| 288 |
@deftp {カテゴリ} foo arg1 arg2 |
| 289 |
[spec]@{module@} fooの説明 |
| 290 |
@end deftp |
| 291 |
@c COMMON |
| 292 |
|
| 293 |
@c EN |
| 294 |
@var{Category} denotes the category of the entry @b{foo}. |
| 295 |
The following categories will appear in this manual: |
| 296 |
@c JP |
| 297 |
@var{カテゴリ} は項目@b{foo}の種別を示します。 |
| 298 |
次のようなカテゴリがあります。 |
| 299 |
@c COMMON |
| 300 |
|
| 301 |
@multitable @columnfractions .4 .6 |
| 302 |
@item Function |
| 303 |
@c EN |
| 304 |
@tab A Scheme function. |
| 305 |
@c JP |
| 306 |
@tab Scheme手続き |
| 307 |
@c COMMON |
| 308 |
@item Special Form |
| 309 |
@c EN |
| 310 |
@tab A special form (in the R7RS term, ``syntax''). |
| 311 |
@c JP |
| 312 |
@tab 特殊形式 (R7RSでは「構文」) |
| 313 |
@c COMMON |
| 314 |
@item Macro |
| 315 |
@c EN |
| 316 |
@tab A macro. |
| 317 |
@c JP |
| 318 |
@tab マクロ |
| 319 |
@c COMMON |
| 320 |
@item Module |
| 321 |
@c EN |
| 322 |
@tab A module |
| 323 |
@c JP |
| 324 |
@tab モジュール |
| 325 |
@c COMMON |
| 326 |
@item Class |
| 327 |
@c EN |
| 328 |
@tab A class. |
| 329 |
@c JP |
| 330 |
@tab クラス |
| 331 |
@c COMMON |
| 332 |
@item Generic Function |
| 333 |
@c EN |
| 334 |
@tab A generic function |
| 335 |
@c JP |
| 336 |
@tab ジェネリックファンクション |
| 337 |
@c COMMON |
| 338 |
@item Method |
| 339 |
@c EN |
| 340 |
@tab A method |
| 341 |
@c JP |
| 342 |
@tab メソッド |
| 343 |
@c COMMON |
| 344 |
@item Reader Syntax |
| 345 |
@c EN |
| 346 |
@tab A lexical syntax that is interpreted by the reader. |
| 347 |
@c JP |
| 348 |
@tab リーダによって解釈される構文要素 |
| 349 |
@c COMMON |
| 350 |
@item Parameter |
| 351 |
@c EN |
| 352 |
@tab A parameter, an object to realize dynamically-bound variables. |
| 353 |
@xref{Parameters and dynamic states}, for the details. |
| 354 |
@c JP |
| 355 |
@tab パラメータ。動的束縛を実現するオブジェクト。 |
| 356 |
詳しくは@ref{Parameters and dynamic states}参照。 |
| 357 |
@c COMMON |
| 358 |
@item Dynamic state |
| 359 |
@c EN |
| 360 |
@tab A procedure that follows a protocol to manage the state by |
| 361 |
dynamic scope. |
| 362 |
@xref{Parameters and dynamic states}, for the details. |
| 363 |
@c JP |
| 364 |
@tab 動的状態。動的スコープで状態を切り替えるプロトコルに従う手続きです。 |
| 365 |
詳しくは@ref{Parameters and dynamic states}参照。 |
| 366 |
@c COMMON |
| 367 |
@item Generic application |
| 368 |
@c EN |
| 369 |
@tab In Gauche, you can ``apply'' a non-procedure object to arguments |
| 370 |
as if it is a procedure (@pxref{Applicable objects}, for the details). |
| 371 |
This entry explains the behavior of an object applied to arguments. |
| 372 |
@c JP |
| 373 |
@tab Gaucheでは、手続きでないオブジェクトをあたかも手続きのように |
| 374 |
引数に「適用」することができます(詳しくは@ref{Applicable objects}を参照してください)。 |
| 375 |
このエントリは、オブジェクトが引数に適用された時のふるまいを説明します。 |
| 376 |
@c COMMON |
| 377 |
@item Subprocess argument |
| 378 |
@c EN |
| 379 |
@tab This appears in @code{do-process} and @code{run-process} to explain |
| 380 |
their keyword argument (@pxref{Running subprocess}) |
| 381 |
@c JP |
| 382 |
@tab これは@code{do-process}と@code{run-process}のキーワード引数の |
| 383 |
説明で使われます (@ref{Running subprocess}参照)。 |
| 384 |
@c COMMON |
| 385 |
@item EC Qualifier |
| 386 |
@c EN |
| 387 |
@tab This is for SRFI-42 Eager Comprehension qualifiers. |
| 388 |
(@pxref{Eager comprehensions}). |
| 389 |
@c JP |
| 390 |
@tab これはSRFI-42の先行評価的内包表記(Eager Comprehension)における |
| 391 |
qualifierの説明に使われます |
| 392 |
(@ref{Eager comprehensions})参照。 |
| 393 |
@c COMMON |
| 394 |
@end multitable |
| 395 |
|
| 396 |
@c EN |
| 397 |
For functions, special forms and macros, the entry may be followed |
| 398 |
by one or more arguments. In the argument list, the following notations |
| 399 |
may appear: |
| 400 |
@c JP |
| 401 |
手続き、特殊形式、マクロに関しては、エントリの後に引数の仕様が示されます。 |
| 402 |
引数リストの中には次のような表記が現れることがあります。 |
| 403 |
@c COMMON |
| 404 |
|
| 405 |
@table @code |
| 406 |
@item arg @dots{} |
| 407 |
@c EN |
| 408 |
Indicates zero or more arguments. |
| 409 |
@c JP |
| 410 |
ゼロ個以上の可変個の引数。 |
| 411 |
@c COMMON |
| 412 |
@item :optional @var{x} @var{y} @var{z} |
| 413 |
@itemx :optional (@var{x} @var{x-default}) (@var{y} @var{y-default}) @var{z} |
| 414 |
@c EN |
| 415 |
Indicates it may take up to three optional arguments. |
| 416 |
The second form specifies default values to @var{x} and @var{y}. |
| 417 |
This is Gauche's enhancement to Scheme; see @ref{Making procedures} |
| 418 |
for the definition of complete argument list syntax. |
| 419 |
@c JP |
| 420 |
省略可能な引数の表記。この例では3つまでの省略可能な引数が取られることを示します。 |
| 421 |
2番目の形式では@var{x}と@var{y}について省略された場合の既定値も示しています。 |
| 422 |
この形式の引数表記は、Schemeに対するGaucheの独自拡張です。 |
| 423 |
完全な仕様については@ref{Making procedures}を参照してください。 |
| 424 |
@c COMMON |
| 425 |
@item :key @var{x} @var{y} @var{z} |
| 426 |
@itemx :key (@var{x} @var{x-default}) (@var{y} @var{y-default}) @var{z} |
| 427 |
@c EN |
| 428 |
Indicates it may take keyword arguments @var{x}, @var{y} and @var{z.} |
| 429 |
The second form shows the default values for @var{x} and @var{y}. |
| 430 |
This is also Gauche's enhancement to Scheme; see @ref{Making procedures} |
| 431 |
for the definition of complete argument list syntax. |
| 432 |
@c JP |
| 433 |
キーワード引数の表記。この例では@var{x}、@var{y}、@var{z}の3つのキーワード引数を |
| 434 |
取ることが示されます。2番目の形式では@var{x}と@var{y}について省略された場合の |
| 435 |
既定値も示しています。 |
| 436 |
この形式の引数表記も、Schemeに対するGaucheの独自拡張です。 |
| 437 |
完全な仕様については@ref{Making procedures}を参照してください。 |
| 438 |
@c COMMON |
| 439 |
@item :rest @var{args} |
| 440 |
@c EN |
| 441 |
Indicates it may take rest arguments. |
| 442 |
This is also Gauche's enhancement to Scheme; see @ref{Making procedures} |
| 443 |
for the definition of complete argument list syntax. |
| 444 |
@c JP |
| 445 |
残りの引数全てがリストになって@var{args}に束縛されることを示します。 |
| 446 |
この形式の引数表記も、Schemeに対するGaucheの独自拡張です。 |
| 447 |
完全な仕様については@ref{Making procedures}を参照してください。 |
| 448 |
@c COMMON |
| 449 |
@end table |
| 450 |
|
| 451 |
@c EN |
| 452 |
Following the entry line, we may indicate the specification the |
| 453 |
entry comes from, and/or the module the entry is provided when |
| 454 |
it's not built-in. |
| 455 |
@c JP |
| 456 |
項目の行に続いて、もし項目が特定の標準に準拠している場合はその標準が示され、 |
| 457 |
また項目が組み込みでない場合はその項目を提供するモジュールが示されます。 |
| 458 |
@c COMMON |
| 459 |
|
| 460 |
@c EN |
| 461 |
The specification is shown in brackets. You'll see the following variations. |
| 462 |
@c JP |
| 463 |
標準は角括弧でくくって表示されます。以下の標準があります。 |
| 464 |
@c COMMON |
| 465 |
|
| 466 |
@table @asis |
| 467 |
@item [R7RS], [R7RS @i{library}] |
| 468 |
@c EN |
| 469 |
It is defined in R7RS. If the entry is about a procedure, a syntax or a |
| 470 |
macro, @i{library} is also shown to indicate |
| 471 |
the name is exported from the @code{scheme.@i{library}} module |
| 472 |
(or the @code{(scheme @i{library})} library, in R7RS terms). |
| 473 |
@c JP |
| 474 |
R7RSで定義されています。このエントリが手続き、構文、マクロについてものならば、 |
| 475 |
@i{library}も合わせて示されます。これは、 |
| 476 |
その名前が@code{scheme.@i{library}}モジュール |
| 477 |
(R7RS用語では、@code{(scheme @i{library})}ライブラリ) |
| 478 |
からエクスポートされてていることを示します。 |
| 479 |
@c COMMON |
| 480 |
@item [R7RS+], [R7RS+ @i{library}] |
| 481 |
@c EN |
| 482 |
It is defined in R7RS, but extended by Gauche, e.g. accepting more |
| 483 |
optional arguments or different type of arguments. |
| 484 |
The description |
| 485 |
contains how it is extended from R7RS. When you're writing a portable |
| 486 |
program, you need to be careful not to use Gauche-specific features. |
| 487 |
@c JP |
| 488 |
R7RSで定義されていますが、Gauche独自の拡張(より多くの省略可能引数を受け付けたり、 |
| 489 |
異なる型の引数についても動作したりなど)があります。 |
| 490 |
説明部分で、R7RSからどう拡張されているかが記述されます。 |
| 491 |
ポータブルなプログラムを書いている時は、Gauche独自拡張の機能を使わないように |
| 492 |
注意してください。 |
| 493 |
@c COMMON |
| 494 |
@item [R6RS], [R6RS+], [R5RS], [R5RS+] |
| 495 |
@c EN |
| 496 |
It is defined in R6RS or R5RS. The plus sign means it has extended by Gauche. |
| 497 |
Since R7RS is mostly upward-compatible to R5RS, and has a lot |
| 498 |
in common with R6RS, we mark an entry as R5RS or R6RS only if |
| 499 |
it is not a part of R7RS. |
| 500 |
@c JP |
| 501 |
R6RSやR5RSで定義されています。 |
| 502 |
プラス記号がついている場合は、Gauche独自の機能が追加されていることを示します。 |
| 503 |
|
| 504 |
R7RSはほぼR5RSの上位互換であり、R6RSとも多くの機能を共有しているので、 |
| 505 |
R5RS、R6RSの表示はそれらがR7RSに含まれていない場合のみ記されます。 |
| 506 |
@c COMMON |
| 507 |
@item [SRFI-@var{n}], [SRFI-@var{n}+] |
| 508 |
@c EN |
| 509 |
The entry works as specified in SRFI-@var{n}. If it is marked as |
| 510 |
"[SRFI-@var{n}+]", the entry has additional functionality. |
| 511 |
@c JP |
| 512 |
この項目はSRFI-@var{n}に定義されるように動作します。 |
| 513 |
"[SRFI-@var{n}+]"とマークされている場合は |
| 514 |
SRFI-@var{n}の仕様に上位互換な形で追加の機能が実装されていることを示します。 |
| 515 |
@c COMMON |
| 516 |
@item [POSIX] |
| 517 |
@c EN |
| 518 |
The API of the entry reflects the API specified in POSIX. |
| 519 |
@c JP |
| 520 |
この項目はPOSIXのAPIを反映していることを示します。 |
| 521 |
@c COMMON |
| 522 |
@end table |
| 523 |
|
| 524 |
@c EN |
| 525 |
The module is shown in curly-braces. If the module isn't shown, |
| 526 |
it is built-in for Gauche. (Note: When you're writing R7RS code, |
| 527 |
Gauche built-ins are available through @code{(gauche base)} module, |
| 528 |
@pxref{Importing gauche built-ins}). |
| 529 |
|
| 530 |
Some entries may be available from more than one modules through |
| 531 |
re-exporting or module inheritance. We only list the primary module |
| 532 |
in that case. |
| 533 |
@c JP |
| 534 |
モジュールは@{@}内に示されます。モジュールが示されていない項目は、 |
| 535 |
Gaucheの組み込みです。(R7RSコードを書いている場合、Gaucheの組み込みは |
| 536 |
@code{(gauche base)}モジュールで提供されます。 |
| 537 |
詳しくは@ref{Importing gauche built-ins}参照)。 |
| 538 |
|
| 539 |
項目によっては、再エクスポートやモジュール継承によって、 |
| 540 |
複数のモジュールから提供されるものもあります。 |
| 541 |
その場合、元になるモジュールが示されます。 |
| 542 |
@c COMMON |
| 543 |
|
| 544 |
@c EN |
| 545 |
Here's an actual entry for an example: |
| 546 |
@c JP |
| 547 |
例として、実際のエントリのひとつはこんな具合です: |
| 548 |
@c COMMON |
| 549 |
|
| 550 |
@example |
| 551 |
-- Function: utf8->string u8vector :optional start end |
| 552 |
[R7RS base] @{gauche.unicode@} Converts a sequence of utf8 octets in |
| 553 |
U8VECTOR to a string. Optional START and/or END argument(s) will |
| 554 |
limit the range of the input. |
| 555 |
@end example |
| 556 |
|
| 557 |
@c EN |
| 558 |
This shows the function @code{utf8->string} is specified by R7RS, in |
| 559 |
@code{(scheme base)} library. Gauche originally provides it from |
| 560 |
@code{gauche.unicode} module. You can import the function from either |
| 561 |
one, but in general, it's good to use @code{(import (scheme base))} |
| 562 |
when writing R7RS code, and @code{(use gauche.unicode)} when writing |
| 563 |
Gauche code. @xref{R7RS integration}, for the details of differences |
| 564 |
in writing in R7RS and Gauche. |
| 565 |
@c JP |
| 566 |
これは、関数@code{utf8->string}はR7RSで定義され、 |
| 567 |
ライブラリ@code{(scheme base)}にある名前となっており、 |
| 568 |
Gaucheではもともと@code{gauche.unicode}モジュールで提供されている、ということを示します。 |
| 569 |
実際に使う場合は、どちらからインポートしても構いません。 |
| 570 |
一般的には、R7RSコードを書いている時には@code{(import (scheme base))}を、 |
| 571 |
Gaucheコードを書いている時には@code{(use gauche.unicode)}を使うと良いでしょう。 |
| 572 |
R7RSとGaucheでの作法の違いについては@ref{R7RS integration}を参照してください。 |
| 573 |
@c COMMON |
| 574 |
|
| 575 |
|
| 576 |
@node Names and namespaces, , Entry format, Notations |
| 577 |
@subsection Names and namespaces |
| 578 |
@c NODE 名前と名前空間 |
| 579 |
|
| 580 |
@c EN |
| 581 |
Since R6RS, you can split toplevel definitions of Scheme programs |
| 582 |
into multiple namespaces. In the standards such namespaces are called |
| 583 |
@emph{libraries}. Gauche predates R6RS and has been calling |
| 584 |
them @emph{modules}, and we use the latter throughout this manual. |
| 585 |
@c JP |
| 586 |
R6RSから、Schemeプログラムのトップレベル定義を複数の名前空間に分けて |
| 587 |
書くことができるようになりました。Schemeの言語標準では名前空間を |
| 588 |
@emph{ライブラリ}と呼んでいます。GaucheはR6RSより前から名前空間を |
| 589 |
サポートし、@emph{モジュール}と呼んできました。本マニュアルでは |
| 590 |
従来どおり@emph{モジュール}という呼称を使います。 |
| 591 |
@c COMMON |
| 592 |
|
| 593 |
@c EN |
| 594 |
(Note: RnRS libraries are more abstract concept than Gauche's |
| 595 |
modules; RnRS defines libraries in a way that they can be implemented |
| 596 |
in various ways, and it just happens that Gauche realises the library |
| 597 |
semantics using modules. When you write a portable R7RS library, |
| 598 |
be aware not to rely on Gauche-specific module semantics. Especially, |
| 599 |
RnRS libraries are more static than Gauche modules; you cannot |
| 600 |
add definitions to exiting libraries within RnRS, for example.) |
| 601 |
@c JP |
| 602 |
(註: RnRSライブラリは、厳密に言えばGaucheのモジュールよりも抽象的な概念です。 |
| 603 |
RnRSでは処理系がライブラリを様々な方法で実装できるように規定しています。 |
| 604 |
Gaucheではたまたま、モジュールという仕組みを使ってRnRSライブラリのの概念が |
| 605 |
実現されているということです。ポータブルなR7RSライブラリを書く時は、 |
| 606 |
Gauche特有のモジュールのセマンティクスに依存しないように気をつけてください。 |
| 607 |
特に、RnRSライブラリはGaucheのモジュールよりも静的です。 |
| 608 |
例えばRnRSの規格内では、既に存在するライブラリに定義を追加することはできません。) |
| 609 |
@c COMMON |
| 610 |
|
| 611 |
@c EN |
| 612 |
Sometimes the same name is used for multiple definitions in |
| 613 |
different modules. If we need to distinguish those names, |
| 614 |
we prefix the name with the module name and a hash sign. |
| 615 |
For example, @code{gauche#lambda} means @code{lambda} |
| 616 |
defined in @code{gauche} module. This does not mean |
| 617 |
you can write @code{gauche#lambda} in the source code, |
| 618 |
though: This notation is just for explanation. |
| 619 |
@c JP |
| 620 |
時に、同じ名前に対して異なるモジュールで別々の定義が与えられることがあります。 |
| 621 |
それらを区別する必要がある時は、本マニュアルでは名前の前にモジュール名と |
| 622 |
ハッシュ記号をつけて表記します。例えば、@code{gauche#lambda}は |
| 623 |
@code{gauche}モジュールで定義された@code{lambda}を指します。 |
| 624 |
これはあくまで説明のための表記で、 |
| 625 |
ソースコードに@code{gauche#lambda}と書けるわけではないことに |
| 626 |
注意してください。 |
| 627 |
@c COMMON |
| 628 |
|
| 629 |
|
| 630 |
@c @node Structure of this document, , Notations, Introduction |
| 631 |
@c @section Structure of this document |
| 632 |
@c @c NODE 本書の構成 |
| 633 |
|
| 634 |
@c @c EN |
| 635 |
|
| 636 |
@c @c JP |
| 637 |
@c @c COMMON |
| 638 |
|
| 639 |
@c Local variables: |
| 640 |
@c mode: texinfo |
| 641 |
@c coding: utf-8 |
| 642 |
@c end: |