~ubuntu-branches/ubuntu/hardy/sigscheme/hardy-proposed

« back to all changes in this revision

Viewing changes to doc/spec.txt

  • Committer: Bazaar Package Importer
  • Author(s): NIIBE Yutaka
  • Date: 2007-01-29 15:31:24 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070129153124-j5fcqyrwcfbczma7
Tags: 0.7.4-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
64-bit data models
9
9
~~~~~~~~~~~~~~~~~~
10
10
 
11
 
  - Supports LL64, LLP64, LP64 and ILP64 (storage-fatty)
12
 
 
13
 
  - storage-compact does not support any of above (yet)
 
11
Supports LL64, LLP64, LP64 and ILP64 on both storage-fatty and storage-compact.
14
12
 
15
13
Addressable memory space
16
14
~~~~~~~~~~~~~~~~~~~~~~~~
24
22
Integer range
25
23
~~~~~~~~~~~~~
26
24
 
27
 
Only supports fixnum, and its range is varied by the user-selected
28
 
underlying storage implementation. The range can be known via SRFI-77
29
 
compatible `(least-fixnum)` and `(greatest-fixnum)`.
 
25
Current implementation only supports fixnum, and its range varies by the
 
26
user-selected underlying storage implementation. The range can be known via
 
27
R6RS (R5.91RS) compatible `(fixnum-width)`, `(least-fixnum)` and
 
28
`(greatest-fixnum)`.
30
29
 
31
30
 
32
31
R5RS conformance
35
34
Proper tail recursion
36
35
~~~~~~~~~~~~~~~~~~~~~
37
36
 
38
 
Supported.
 
37
Supported. But the conformance of `eval` procedure is uncertain. See the
 
38
comments of `scm_p_eval()` and `rec-by-eval` of `test-tail-rec.scm` for further
 
39
information about `eval`.
39
40
 
40
41
Continuations
41
42
~~~~~~~~~~~~~
49
50
Macros
50
51
~~~~~~
51
52
 
52
 
The hygienic macros are fully supported.
 
53
The hygienic macros are fully supported. But although the macro expansion
 
54
engine itself works well and can be expected as R5RS-conformant, its
 
55
integration into SigScheme is not fully validated yet. It is likely having a
 
56
problem on identifier references.
53
57
 
54
58
Numbers
55
59
~~~~~~~
56
60
 
57
 
Only integer part is implemented.
 
61
SigScheme supports only the integer part of the numerical tower.
 
62
 
 
63
Literals
 
64
^^^^^^^^
 
65
 
 
66
SigScheme recognizes only these limited part of numerical forms of "7.1.1
 
67
Lexical structure" section of R5RS. Other valid R5RS forms for numbers produce
 
68
errors.
 
69
 
 
70
----------------------------------------------------------------
 
71
  <number> --> <num 2>| <num 8>
 
72
       | <num 10>| <num 16>
 
73
  
 
74
  <num R> --> <prefix R> <complex R>
 
75
  <complex R> --> <real R>
 
76
  <real R> --> <sign> <ureal R>
 
77
  <ureal R> --> <uinteger R>
 
78
  <uinteger R> --> <digit R>+ #*   ;; '#' must not occur
 
79
  <prefix R> --> <radix R>
 
80
 
 
81
  <sign> --> <empty>  | + |  -
 
82
  <radix 2> --> #b
 
83
  <radix 8> --> #o
 
84
  <radix 10> --> <empty> | #d
 
85
  <radix 16> --> #x
 
86
  <digit 2> --> 0 | 1
 
87
  <digit 8> --> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
 
88
  <digit 10> --> <digit>
 
89
  <digit 16> --> <digit 10> | a | b | c | d | e | f 
 
90
  <digit> --> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
 
91
----------------------------------------------------------------
 
92
 
 
93
SigScheme accepts only lower case alphabets as radices as follows. But
 
94
hexadecimal digits can be written as either lower or upper.
 
95
 
 
96
----------------------------------------------------------------
 
97
  #b11  ==>  3
 
98
  #B11  ==>  error
 
99
  #xa1  ==>  161
 
100
  #Xa1  ==>  error
 
101
  #xAb  ==>  171
 
102
----------------------------------------------------------------
 
103
 
 
104
SigScheme uses a fixed-size buffer for number literals parsing. Due to the
 
105
implementation, it can accept only one optional '0' prefix for maximum-length
 
106
binary number literals. Two or more '0' prefixes causes an error as follows.
 
107
 
 
108
----------------------------------------------------------------
 
109
  ;; storage-compact on ILP32 env
 
110
 
 
111
  (greatest-fixnum)                      ==> 2147483647
 
112
  #b11111111000000001111111100000000     ==> 4278255360
 
113
  #b011111111000000001111111100000000    ==> 4278255360
 
114
  #b0011111111000000001111111100000000   ==> error
 
115
  #b00011111111000000001111111100000000  ==> error
 
116
----------------------------------------------------------------
 
117
 
 
118
Optional procedures
 
119
^^^^^^^^^^^^^^^^^^^
 
120
 
 
121
The procedures '-' and '/' support following optional form.
 
122
 
 
123
----------------------------------------------------------------
 
124
  6.2.5 Numerical operations
 
125
 
 
126
  optional procedure: - z1 z2 ...
 
127
  optional procedure: / z1 z2 ...
 
128
----------------------------------------------------------------
 
129
 
58
130
 
59
131
Characters
60
132
~~~~~~~~~~
61
133
 
62
134
All character category-sensitive procedures and predicates (such as
63
 
char-upcase) work correctly only in ASCII range. i.e. Neigher Unicode
 
135
char-upcase) work correctly only in ASCII range. i.e. Neither Unicode
64
136
processing specified in SRFI-75 nor other non-Unicode multibyte character
65
137
processing are supported in such procedures/predicates.
66
138
 
245
317
.SCM_STRICT_ARGCHECK enabled
246
318
================================================================
247
319
  sscm> (car '(1 2) 3 4)
248
 
  ERROR: in (function call): superfluous argument(s): (3 4)
 
320
  Error: in (function call): superfluous argument(s): (3 4)
249
321
  sscm> (symbol? 'foo . #t)
250
 
  ERROR: in (function call): improper argument list terminator: #t
 
322
  Error: in (function call): improper argument list terminator: #t
251
323
  sscm> (+ 3 4 . 5)
252
 
  ERROR: in (reduction): improper argument list terminator: 5
 
324
  Error: in (reduction): improper argument list terminator: 5
253
325
================================================================
254
326
 
255
327
.SCM_STRICT_ARGCHECK disabled
304
376
  - *procedure:* exact->inexact z
305
377
  - *procedure:* inexact->exact z
306
378
 
 
379
Promises
 
380
^^^^^^^^
 
381
 
 
382
  - *library syntax:* delay <expression>
 
383
  - *library procedure:* force promise
 
384
 
307
385
System interface
308
386
^^^^^^^^^^^^^^^^
309
387
 
319
397
 
320
398
Although a C implementation `module-srfi1.c` is existing, it is still broken
321
399
and should not use for production codes. To get SRFI-1 working with SigScheme,
322
 
use SLIB version of the library (will made available after some preparations).
 
400
use SLIB version of the library (will be made available after some
 
401
preparations).
 
402
 
 
403
 
 
404
SRFI-22 Running Scheme Scripts on Unix
 
405
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
406
 
 
407
SigScheme only supports the prelude line interpretation. All options written in
 
408
the line are applied as same as commandline invocation of sscm. But the `main`
 
409
procedure invocation is not supported (yet).
 
410
 
 
411
.Prelude line is interpreted as follows
 
412
================================================================
 
413
  #! /usr/bin/env sscm -C UTF-8
 
414
  ...
 
415
 
 
416
  ==> Character encoding for the file is changed to UTF-8 temporarily.
 
417
================================================================
323
418
 
324
419
 
325
420
SRFI-23 Error Reporting Mechanism
326
421
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
327
422
 
328
 
The `error` procedure throws a SigScheme-specific error object in cooperate
329
 
with "SRFI-34 Exception Handling for Programs". Since the error objects are
330
 
represented as a list, be careful on catching an exception based on its type.
331
 
If you want to distinguish the error objects from ordinary lists, use
332
 
SigScheme-specific `%%error-object?` predicate.
 
423
If srfi-34 is provided, the `error` procedure throws a SigScheme-specific error
 
424
object in cooperate with "SRFI-34 Exception Handling for Programs". Otherwise
 
425
it simply calls scm_fatal_error(). Since the error objects are represented as a
 
426
list, be careful on catching an exception based on its type.  If you want to
 
427
distinguish the error objects from ordinary lists, use SigScheme-specific
 
428
`%%error-object?` predicate.
333
429
 
334
430
.Error objects are also caught as a list
335
431
================================================================
352
448
  #t
353
449
================================================================
354
450
 
 
451
SRFI-28 Basic Format Strings
 
452
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
453
 
 
454
SigScheme fully supports SRFI-28. A directive-less tilde at end of a format
 
455
string causes an error as same as the reference implementation of SRFI-28.
 
456
 
 
457
.SigScheme
 
458
================================================================
 
459
  (format "~")   ==> error
 
460
  (format "a~")  ==> error
 
461
================================================================
 
462
 
355
463
SRFI-38 External Representation for Data with Shared Structure
356
464
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
357
465
 
358
466
Only `write-with-shared-structure` is implemented and
359
467
`read-with-shared-structure` is not. The optional alias `write/ss` described in
360
 
SRFI-38 is also defined.
 
468
SRFI-38 is also defined. The optional `optarg` argument is simply ignored.
361
469
 
362
470
The shared index starts with #1 (not #0).
363
471
 
374
482
SRFI-48 Intermediate Format Strings
375
483
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
376
484
 
 
485
SigScheme fully supports SRFI-48.
 
486
 
377
487
The 'd' part of '~w,dF' directive is acceptable, but completely ignored on
378
488
output format. Since SigScheme only supports integer currently, number is
379
489
always formatted as integer even if the 'd' part is specified.
380
490
 
381
 
.proper behavior
382
 
================================================================
383
 
  (format "~3F"   3)  => "  3"
384
 
  (format "~3,2F" 3)  => "3.00"
385
 
================================================================
386
 
 
387
 
.SigScheme
388
 
================================================================
389
 
  (format "~3F"   3)  => "  3"
390
 
  (format "~3,2F" 3)  => "  3"
391
 
================================================================
 
491
.Proper behavior
 
492
================================================================
 
493
  (format "~3F"   3)  ==> "  3"
 
494
  (format "~3,2F" 3)  ==> "3.00"
 
495
================================================================
 
496
 
 
497
.SigScheme
 
498
================================================================
 
499
  (format "~3F"   3)  ==> "  3"
 
500
  (format "~3,2F" 3)  ==> "  3"
 
501
================================================================
 
502
 
 
503
Although the reference implementation of SRFI-48 allows directive-less tilde at
 
504
end of a format string, SigScheme rejects it as an error since it decreases
 
505
user-code portability, and is confusable due to that the behavior is different
 
506
to the reference implementation of SRFI-28.
 
507
 
 
508
.Reference implementation of SRFI-48
 
509
================================================================
 
510
  (format "~")   ==> "~"
 
511
  (format "a~")  ==> "a~"
 
512
================================================================
 
513
 
 
514
.SigScheme
 
515
================================================================
 
516
  (format "~")   ==> error
 
517
  (format "a~")  ==> error
 
518
================================================================
 
519
 
392
520
 
393
521
SRFI-60 Integer as Bits
394
522
~~~~~~~~~~~~~~~~~~~~~~~
440
568
SRFI-75 R6RS Unicode data
441
569
~~~~~~~~~~~~~~~~~~~~~~~~~
442
570
 
443
 
  - quoted-symbol by vertical bar (|) is not supported yet
444
 
 
445
 
FIXME
 
571
SRFI-75 is partially implemented. But since SRFI-75 had already been obsoleted,
 
572
it is not validated deeply. It will be replaced with stable R6RS implementation
 
573
once the specifications have been stabilized
 
574
 
 
575
Current SRFI-75 status
 
576
^^^^^^^^^^^^^^^^^^^^^^
 
577
 
 
578
  - Supports Unicode character literals such as #\λ
 
579
  - Supports #xXX, #\uXXXX and #\UXXXXXXXX literals
 
580
  - Supports Unicode identifiers (lacks character category validation)
 
581
  - Supports all named chars such as #\backspace, #\esc, and #\nul
 
582
  - Quoted-symbol by vertical bar (such as '|-symbol|) is not supported
 
583
 
 
584
TODOs
 
585
^^^^^
 
586
 
 
587
  - Remove #\uXXXX and #\UXXXXXXXX literals
 
588
  - Support variable-length #\xXX literal
 
589
  - Support character category validation for identifiers
 
590
  - Disable #\newline on R6RS-compatible mode
 
591
  - Confirm symbol escape syntax (not defined in R6RS yet)
446
592
 
447
593
 
448
594
SIOD compatibility
449
595
------------------
450
596
 
 
597
FIXME: describe them.
 
598
 
451
599
  - #f and '()
452
600
 
453
601
  - let and let* bindings