
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 system. 8: Here I tried to describe the implementation precisely, 9: sometimes referring to background design choices. 10: @c JP 11: ???auche Scheme system?˴ؤ??ë¡¢?桼???Τ????????ɤ??????????Ǥ????ʤ???Gauche?μ????Τ˵??Ò¤??뤳?Ȥ?Ū?Ȥ??Æ¡????ˤ?طʤȤʤ??×¾????????????Ƥ??Þ¤??? 12: @c COMMON 13: 14: @c EN 15: The target readers are those who already know Scheme and 16: want to write useful programs in Gauche. 17: For those who are new to Scheme, it'll be easier to start 18: from some kind of tutorial. I'm planning to write one. 19: @c JP 20: ???????äơ???heme??äƤ???auche?????ǽ??Ѥ????×¥í¥°??????????Ȥ?????Ô¤?ݤˤ??Ƥ??Þ¤??? 21: Scheme?Ë¿????Τ????Ƥ?ɼԤϡ????餫?Î¥?塼?ȥꥢ??Ê»????? 22: ????Ǥ??礦???????????塼?ȥꥢ????????????Ĥ??Ǥ??? 23: @c COMMON 24: 25: @c EN 26: This manual only deals with Scheme side of things. Gauche has 27: another face, a C interface. Details of it will be discussed 28: in a separate document to be written. 29: Those who wants to use Gauche as an embedded language, or wants 30: to write an extension, need that volume. 31: @c JP 32: ???Υޥ˥奢???Ï¡?Gauche??cheme??????Ƥ?̤Τߤò°·¤??Þ¤??? 33: Gauche????줫???Ù¤???ꥹ?Ƚ??饤?Ö¥??Ȥ??Ƥ??????äƤ??Þ¤????? 34: ??????É¥?????Dz??????Ǥ???Gauche??ß¹??߸?????ƻȤ??????? 35: ?⤷????auche??????????????Ȥ?????ԤϤ??Υɥ??????ɬ??Ȥʤ????? 36: @c COMMON 37: 38: @c EN 39: For the Scheme side, I tried to make this manual self-contained 40: for the reader's convenience, i.e. as far as you want to look up 41: Gauche's features you don't need to refer to other documents. 42: For example, description of functions defined in the standard 43: documents are included in this manual, instead of saying 44: ``see the standard document''. However, this document is not a verbatim 45: copy of the standard documents; sometimes I omit detailed 46: discussions for brevity. 47: I put pointers to the original documents, so please consult them if you 48: need to refer to the standards. 49: @c JP 50: Scheme??????Ƥ????˴ؤ??Ƥϡ??ʤ??????Υޥ˥奢????Õ¥??????Ȥ??Ƥ????Â???褦?˵??Ò¤??Þ¤?????ɸ?????????????â¡¢??????ޥ˥奢???????Ȥ??Τ????Ê»??뤳?Ȥ??Ǥ??Þ¤???â???????Υޥ˥奢??ɸ????ؤ??ˤ??ʤ????ó¡£µ??Ò¤?????뤿????Ū??طʤʤɤϾ?????Ƥ??????? 51: ???ꥸ?Ê¥??É¥?????ؤΥݥ??󥿤ò»²¹?????ι??夲?Ƥ????Þ¤????Τǡ? 52: ɬ??˱????Æ»??Ȥ??Ʋ??????? 53: @c COMMON 54: 55: @c EN 56: If you're reading this document off-line, you may find the most 57: recent version on the web: 58: @c JP 59: ?⤷???ʤ??????Υޥ˥奢?????ե饤??ɤ?????é¡¢ 60: ??????????RL????Ã¥????ƤߤƲ????????????????뤫?⤷??????@c COMMON 61: @example 62: @uref{http://practical-scheme.net/gauche/}. 63: @end example 64: 65: @c JP 66: ?ʤ?????ޥ˥奢??????????Ï¡? 67: ??Æ£ ? ?á¡¢???? ??? ?????????Þ¤????? 68: @c COMMON 69: 70: @menu 71: * Overview of Gauche:: 72: * Notations:: 73: @end menu 74: 75: @node Overview of Gauche, Notations, Introduction, Introduction 76: @section Overview of Gauche 77: @c NODE Gauche?γ?? 78: 79: @c EN 80: Gauche is a script interpreter based on Scheme. 81: Gauche conforms the language standard 82: "Revised^5 Report on the Algorithmic Language Scheme" 83: (@ref{r5rs,[R5RS],R5RS}), 84: and supports various common libraries defined in SRFIs 85: (@uref{http://srfi.schemers.org}). 86: @c JP 87: Gauche??cheme?????????????È¥??󥿥ץ꥿?Ǥ??? 88: Scheme???ɸ?????ë¡¢"Revised^5 Report on the Algorithmic Language Scheme" 89: (@ref{r5rs,[R5RS],R5RS})?˽????Ƥ??Þ¤????Þ¤???SRFI 90: (@uref{http://srfi.schemers.org}) ?˵??????????¿???Υ饤?Ö¥????Ý¡??Ȥ??Ƥ??Þ¤??? 91: @c COMMON 92: 93: @c EN 94: The goal of Gauche is to provide a handy tool for 95: programmers and system administrators to handle 96: daily works conveniently and efficiently in the production environment. 97: @c JP 98: Gauche?Ï¡??×¥í¥°???䥷???Æ¥???Ô¤????ʤ????????????Scheme?ǽñ¤±¤????ˤ??뤳?Ȥ???Ȥ???߷פ??????Þ¤??? 99: @c COMMON 100: 101: @c EN 102: There are lots of Scheme implementations available, and each 103: of them has its design emphasis and weaknesses. Gauche is 104: designed with emphasis on the following criteria. 105: @c JP 106: ???????????cheme?μ?õ¤¬¤????????? 107: ???줾?????????û?꤬???????? 108: Gauche??Ĺ??????????????Ƥ????ϼ??Τ褦?ʥݥ???Ǥ??? 109: @c COMMON 110: 111: @table @b 112: @c EN 113: @item Quick startup 114: @c JP 115: @item Ω?????®??????@c COMMON 116: @c EN 117: One of the situation Gauche is aiming at is in the production 118: environment, where you write ten-lines throw-away script that 119: may invoked very frequently. This includes CGI scripts as well. 120: Gauche includes a set of most common features in its executable, 121: while splits less common stuffs into libraries which are to be loaded 122: on demand, to make itself start quickly. 123: @c JP 124: Gauche???????Ƥ?????ΤҤȤĤϡ??×¥????????Ķ??Ǥ???ä?10?Ô¥??????Ȥ?ä?????Æ¡????줬??????˸ƤФ??褦?Ê¥??????Ǥ??? 125: CGI???????Ȥʤɤ⤽???Ǥ??? 126: Gauche?Ǥϡ?????????È¥??????ȤȤ???ɤ??Ȥ??????ʵ?ǽ?˹ʤä??¹ԥե???????????륤?ó¤·¡??Ȥ?ʬ???????????ǽ?????˱???????ß¹??????ˤ??Ƥ??Þ¤??? 127: @c COMMON 128: 129: @c EN 130: @item Multibyte strings 131: @c JP 132: @item ?Þ¥??Ð¥??????c COMMON 133: @c EN 134: We can no longer live happily in ASCII-only or 1-byte-per-character world. 135: The practical language implementations are required to handle 136: multibyte (wide) characters. 137: Gauche supports multibyte strings natively, providing robust and 138: consistent support than @i{ad hoc} library-level implementation. 139: @xref{Multibyte Strings}, for details. 140: @c JP 141: ʸ??1?Ð¥??È¥????????Τߤò°·¤Ã¤Æ¤???????ä?????ϲ᤮???Þ¤????? 142: ????Î¥×¥í¥°???ó¥°¥????Æ¥???????Ê¥??󥳡??Ç¥??󥰤ˤ??Þ¥??Ð¥???????? 143: ????˰???????????????? 144: Gauche???Ū???????Æ¡???????????????????󥳡??Ç¥??ó¥°¤??Þ¥??Ð¥?????????ư????Þ¤????夫????Â?????饤?Ö¥????????Þ¥??Ð¥?????????Ý¡??Ȥ??â¡¢??????????Ð¥??Ȥ?????????ˤʤäƤ??Þ¤??? 145: ?ܤ?????ref{Multibyte Strings}?ò»²¾È¤??Ƥ???????? 146: @c COMMON 147: 148: @c EN 149: @item Modular development 150: @c JP 151: @item ?⥸??????ȯ 152: @c COMMON 153: @c EN 154: Gauche has a simple module system to separate namespaces, 155: which allows the developers to work in parallel without 156: worrying name collision. 157: @c JP 158: Gauche???????????????⥸?塼?륷???Æ¥?????Ƥ??ê¡¢ 159: ̾??ξ?ͤ?Û¤?????????ȯ?Ô¤???Ô¤??ƺ??ò¤¹¤ë¤³?Ȥ??Ǥ??Þ¤??? 160: @c COMMON 161: 162: @c EN 163: @item Integrated object system 164: @c JP 165: @item ??礵?줿???Ö¥??????È¥????Æ¥?c COMMON 166: @c EN 167: A powerful CLOS-like object system with MetaObject protocol 168: (mostly compatible with STklos and Guile) is provided. 169: @c JP 170: CLOS?饤???ʥ᥿???Ö¥??????È¥×¥??????????????Ê¥??Ö¥??????È¥????Æ¥????ß¹??????????STklos??ile?Î¥??Ö¥??????È¥????Æ¥????ʤ?????????????? 171: @c COMMON 172: 173: @c EN 174: @item System interface 175: @c JP 176: @item ?????ƥ।?󥿥ե????? 177: @c COMMON 178: @c EN 179: Although Scheme abstracts lots of details of the machine, 180: sometimes you have to bypass these high-level layers and 181: go down to the basement to make things work. 182: Gauche has built-in support of most of POSIX.1 system calls. 183: Other modules, such as networking module, usually provide 184: both high-level abstract interface and low-level interface 185: close to system calls. 186: @c JP 187: Scheme?Ï·×»????ξܺ٤??????ݲ????Þ¤??????×¥í¥°??????Ƥ????? 188: ?????ι??Ù¥?????Ñ¥?????ϲ????˹ߤ??????ʤ????ʤ????褦?Ê»??? 189: ????????Gauche??OSIX.1?????ƥॳ?????ۤȤ??ß¹??ߤǥ??Ý¡??Ȥ??Þ¤??? 190: ?Þ¤????ͥåȥ???󥰥⥸?塼??????Î¥????Æ¥?Ï¢?⥸?塼????ï¡¢ 191: ???Ù¥??????Ê¥??󥿥ե?????????Ù¥??????ƥॳ?????ᤤ???󥿥ե??????????????Þ¤??? 192: @c COMMON 193: 194: @c EN 195: @item Enhanced I/O 196: @c JP 197: @item ???????줿????@c COMMON 198: @c EN 199: No real application can be written without dealing with I/O. 200: Scheme neatly abstracts I/O as a port, but defines least operations on it. 201: Gauche uses a port object as a unified abstraction, providing 202: utility functions to operate on the underlying I/O system. 203: @xref{Input and output}, for the basic I/O support. 204: @c JP 205: ?ʪ?Î¥??ץꥱ????????/O̵???Ǥ??????Þ¤???Scheme??/O????ȤȤ??Æ´Ê·???ݲ????Ƥ??Þ¤????? 206: ɸ??Scheme?ˤϺ??????????????????Þ¤???Gauche?ϥݡ??È¥??Ö¥??????Ȥ??ϤΤ?????礵?줿??ݲ????Ö¥??????Ȥȹͤ??? 207: ????????Ʋ??̤?/O?????Æ¥??Ë¥??????????????Æ¥??????Ø¿?󶡤??Ƥ??Þ¤??? 208: @ref{Input and output}?ò»²¾È¤??Ʋ??????? 209: @c COMMON 210: @end table 211: 212: @c EN 213: On the other hand, Gauche is @emph{not} designed for 214: applications such like high-performance number cruncher or 215: very large scale database handling. It is an interpreter, after all. 216: 217: You can still use Gauche as a "glue" language for such applications, 218: however. For example, you can write a performance-critical part 219: in another language that compiles to native code, and use Gauche to set up. 220: @c JP 221: ????Gauche?Ͻ????󥿥ץ꥿?Ǥ????é¡¢??????η׻??ò¤³¤Ê¤??????ʥǡ??????åȤò°·¤Ã¤??ꤹ???϶??Ǥ??? 222: 223: â???????Τ褦?ʾ??Ǥ⡢Gauche???????Í¥??ʤ??ָҡ׸???????Ȥ????Ȥϲ???Ǥ?????????ǽ??×µ????????ʬ?ϥͥ??Æ¥??Ö¥????ɤ˥?????뤹???? 224: ?ñ¤¤¤Æ¤????????åȥ??åפ?auche????Ȥ??ä??Ë¡?????????? 225: @c COMMON 226: 227: 228: @node Notations, , Overview of Gauche, Introduction 229: @section Notations 230: @c NODE ɽ???ˤĤ??? 231: @c EN 232: In this manual, each entry is represented like this: 233: 234: @deftp {Category} foo arg1 arg2 235: [spec] Description of foo @dots{} 236: @end deftp 237: @c JP 238: ???Υޥ˥奢???Ï¡??ƹ??ϼ??Τ褦?Ê¥Õ¥????ޥåȤ???????????Þ¤??? 239: 240: @deftp {???Æ¥???foo arg1 arg2 241: [spec] foo??? 242: @end deftp 243: @c COMMON 244: 245: @c EN 246: @var{Category} denotes the category of the entry @b{foo}. 247: The following category will appear in this manual: 248: @c JP 249: @var{???Æ¥????Ϲ?@b{foo}?μ??ò¼¨¤??Þ¤??? 250: ???Τ褦?Ê¥??Æ¥??꤬???????? 251: @c COMMON 252: 253: @multitable @columnfractions .4 .6 254: @item Function 255: @c EN 256: @tab A Scheme function. 257: @c JP 258: @tab Scheme???? 259: @c COMMON 260: @item Special Form 261: @c EN 262: @tab A special form (in the R5RS term, ``syntax''). 263: @c JP 264: @tab ????? (R5RS?Ǥϡֹ?ʸ?? 265: @c COMMON 266: @item Macro 267: @c EN 268: @tab A macro. 269: @c JP 270: @tab ?Þ¥???c COMMON 271: @item Module 272: @c EN 273: @tab A module 274: @c JP 275: @tab ?⥸?塼??c COMMON 276: @item Class 277: @c EN 278: @tab A class. 279: @c JP 280: @tab ???饹 281: @c COMMON 282: @item Generic Function 283: @c EN 284: @tab A generic function 285: @c JP 286: @tab ?????Í¥????Õ¥??󥯥??? 287: @c COMMON 288: @item Method 289: @c EN 290: @tab A method 291: @c JP 292: @tab ?᥽?Ã¥?@c COMMON 293: @item Reader Syntax 294: @c EN 295: @tab A lexical syntax that is interpreted by the reader. 296: @c JP 297: @tab ?꡼??ˤ??Ʋ??????ʸ?? 298: @c COMMON 299: @end multitable 300: 301: @c EN 302: For functions, special forms and macros, the entry may followed 303: by one or more arguments. In the argument list, the following notations 304: may appear: 305: @c JP 306: ??????????????Þ¥????ؤ??Ƥϡ????????????ͤ??????????? 307: ?????Ȥ???ϼ??Τ褦??????????????Ȥ????????? 308: @c COMMON 309: 310: @table @var 311: @item arg @dots{} 312: @c EN 313: Indicates zero or more arguments. 314: @c JP 315: ?????ʾ???ѸĤΰ? 316: @c COMMON 317: @item &optional x y z 318: @itemx &optional (x x-default) (y y-default) z 319: @c EN 320: Indicates it may take up to three optional arguments. 321: The second form specifies default values. 322: Note that Gauche doesn't really support Common-Lisp style 323: @code{&optional} argument specifier in the lambda list. 324: I use this notation since it is useful to indicate valid pattern of arguments. 325: @c JP 326: ???????ʰ?ɽ????????????ĤޤǤξ??????ʰ????????Ȥò¼¨¤??Þ¤??? 327: 2???η???ǤϾ?????줿???δ??⼨???Ƥ??Þ¤??? 328: ?????????ommonLisp?Î¥????????ʤ??Ƥ??Þ¤?????Gauche???Ȥ?????ꥹ?Ȥ?@code{&optional}?Τ褦????????????????ǤϤʤ????Ȥ?????Ƥ???????? 329: ?ޥ˥奢??ɽ????????뤿?????Τ褦?????????Ƥ??????Ǥ??? 330: @c COMMON 331: @item &keyword x y z 332: @itemx &keyword (x x-default) (y y-default) z 333: @c EN 334: Indicates it may take keyword arguments @var{x}, @var{y} and @var{z.} 335: Note that Gauche doesn't really support Common-Lisp style 336: @code{&keyword} argument specifier in the lambda list. 337: I use this notation since it is useful to indicate valid pattern of arguments. 338: @c JP 339: ??????ɰ?ɽ???????????var{x}??@var{y}??@var{z}???ĤΥ?????ɰ? 340: ?????Ȥ???????????2???η???ǤϾ?????줿???δ??⼨???????? 341: ?????????ommonLisp?Î¥????????ʤ??Ƥ??Þ¤?????Gauche???Ȥ?????ꥹ?Ȥ?@code{&keyword}?Τ褦????????????????ǤϤʤ????Ȥ?????Ƥ???????? 342: ?ޥ˥奢??ɽ????????뤿?????Τ褦?????????Ƥ??????Ǥ??? 343: @c COMMON 344: @item &rest args 345: @c EN 346: Indicates it may take rest arguments. 347: Note that Gauche doesn't really support Common-Lisp style 348: @code{&rest} argument specifier in the lambda list. 349: I use this notation since it is useful to indicate valid pattern of arguments. 350: @c JP 351: ?Ĥ????Ƥ??ꥹ?Ȥˤʤä?var{args}???????????Ȥò¼¨¤??Þ¤??? 352: ?????????ommonLisp?Î¥????????ʤ??Ƥ??Þ¤?????Gauche???Ȥ?????ꥹ?Ȥ?@code{&rest}?Τ褦????????????????ǤϤʤ????Ȥ?????Ƥ???????? 353: ?ޥ˥奢??ɽ????????뤿?????Τ褦?????????Ƥ??????Ǥ??? 354: @c COMMON 355: @end table 356: 357: @c EN 358: The description of the entry follows the entry line. 359: If the specification of the entry comes from some standard or 360: implementation, its origin is noted in the bracket at the beginning 361: of the description. The following origins are noted: 362: @c JP 363: ???????ιԤ?????Þ¤????⤷????????????????Ƥ??????? 364: ???Ȥʤä?ɸ?ब???Τ褦?Ê·???Ǽ????????? 365: @c COMMON 366: 367: @table @asis 368: @item [R5RS] 369: @itemx [R5RS+] 370: @c EN 371: The entry works as specified in ``Revised^5 Report of Algorithmic Language 372: Scheme.''. If it is marked as "[R5RS+]", the entry has additional 373: functionality. 374: @c JP 375: ???ι???5RS????????褦?????Þ¤???"[R5RS+]"?È¥Þ¡????????????? 376: R5RS?λ?ͤ˾??ß´??Ê·??ɲäε?ǽ????õ¤µ¤????뤳?Ȥò¼¨¤??Þ¤??? 377: @c COMMON 378: @item [SRFI-@var{n}] 379: @itemx [SRFI-@var{n}+] 380: @c EN 381: The entry works as specified in SRFI-@var{n}. If it is marked as 382: "[SRFI-@var{n}+]", the entry has additional functionality. 383: @c JP 384: ???ι???RFI-@var{n}????????褦?????Þ¤???"[SRFI-@var{n}+]"?È¥Þ¡????????????? 385: SRFI-@var{n}?λ?ͤ˾??ß´??Ê·??ɲäε?ǽ????õ¤µ¤????뤳?Ȥò¼¨¤??Þ¤??? 386: @c COMMON 387: @item [POSIX] 388: @c EN 389: The API of the entry reflects the API specified in POSIX. 390: @c JP 391: ???ι???OSIX??PI??Ǥ??Ƥ??뤳?Ȥò¼¨¤??Þ¤??? 392: @c COMMON 393: @end table 394: 395: @c @node Structure of this document, , Notations, Introduction 396: @c @section Structure of this document 397: @c @c NODE ????? 398: 399: @c @c EN 400: @c @c JP 401: @c @c COMMON 402: