Chicken Scheme 6.0
Chicken Scheme 6.0: Release Overview
The 6.0.0 update marks a significant milestone, primarily by integrating all modules defined by the R7RS small language directly into the core system.
🌐 String & Character Enhancements
The internal architecture for strings has been overhauled to use UTF-8, ensuring full compatibility.
- Indexing: Locatives on strings are now based on code-points rather than raw bytes.
- Character Management: The
char-nameprocedure now supports the removal of named character definitions. - Escaping:
symbol-escapenow toggles whether symbols are displayed in escaped mode (|...|).- Symbol printing logic is now more rigorous regarding when escaping is required.
Hexadecimal escape sequencesnow strictly require a terminating;character, adhering to R7RS standards.
📦 Data Handling & I/O
Bytevectors and Blobs
The system has transitioned from (chicken blob) to (chicken bytevector), which provides R7RS-compliant operations.
| Old Procedure | New Requirement / Status |
|---|---|
file-read | Now requires a bytevector (strings no longer accepted) |
file-write | Now requires a bytevector (strings no longer accepted) |
set-pseudo-random-seed! | Now requires a bytevector |
random-bytes | Now requires a bytevector |
read-u8vector | Use (chicken io) |
write-u8vector | Use (chicken io) |
Port & File Operations
- Encodings:
open-input-fileandopen-output-filenow support encoding arguments (Default:UTF-8; also supportsLatin-1). - Port Creation:
make-input-portandmake-output-portnow utilize keyword arguments for optional methods. - New Ports: Added
make-binary-input-portandmake-binary-output-port. - Port Naming:
has been deleted; please use the SRFI-17 setter forset-port-name!port-name. - File Locking: The
(chicken file posix)module now employs theflock(2)system call, which is thread-safe and operates on entire files.
🏗️ Module Architecture & Migration
Many primitives have been relocated to align with R7RS.
Detailed Relocations
- To
(scheme base):exact-integer?,exact-integer-sqrt?,vector-copy!,make-parameter,call/cc,open-input-string,open-output-string,get-output-string,input-port-open?,output-port-open?,parameterize, andport?. - To
(scheme case-lambda):case-lambda. - To
(scheme base)(with signature change):write-string(moved from(chicken io)). - Generative Records:
define-record-typeis now generative and resides in(scheme base). Consequently,record-instance?andmake-record-instancenow accept non-symbolic type specifiers.
Deprecations & Renaming
- Remove
srfi-0,srfi-6,srfi-9,srfi-11,srfi-23,srfi-39, andsrfi-98(absorbed by R7RS). - Rename
r4rs,r5rs,r4rs-null, andr5rs-nullto(scheme XXX). - Rename platform identifier
mingw32tomingw.
🔢 Numerical & Mathematical Updates
Number Vectors
A new module, (chicken number-vector), provides a superset of SRFI-4, adding support for 64-bit and 128-bit complex number vectors. The original srfi-4 module remains but is restricted to the SRFI-4 specification.
Complex Numbers & Arithmetic
Using LaTeX notation, the following logic now applies:
- Rectangulars:
make-rectangularreturns a complex number if the imaginary part is an inexact . - Imaginary Parts:
imag-partreturns an exact when the input is not a complex number. - Parsing:
string->numberand the reader now correctly process complex numbers where the imaginary part is a negative inexact (e.g., ). - Comparison:
maxandminwill ignoreNaNvalues provided a non-NaNargument is present.
Base Conversion
number->string now supports bases up to (previously ). string->number has been improved to handle the character "i" more consistently in bases .
⚙️ Syntax & Compiler
Expansion & Macros
- Single Expansion: Added
expand1to(chicken syntax)and the,x1command tocsifor expanding macros exactly once. - Tail Patterns:
syntax-rulesnow offers improved support for tail patterns involving ellipses. - Includes:
includeandinclude-relativenow accept multiple files;include-ciis newly available. - Library Specs:
define-librarynow supportsexport-all.
Read Syntax
The #ci'/#cs'` syntaxes are gone. Use the following instead:
#!fold-case
#!no-fold-case
🔌 Foreign Function Interface (FFI)
The FFI has been optimized for performance and flexibility:
- Direct Passing: Strings and symbols are no longer copied when passed to foreign code. Warning: Mutations made by external C code will be reflected in Scheme.
- Direct Types: C structs, unions, and complex numbers can now be passed as arguments and returned as results directly.
🛠️ Tooling & Installation
Compiler & Interpreter
- The flag
-r5rs-syntaxis now-r7rs-syntaxand no longer disables extended symbol syntax. - Paths: Library procedures and
make-pathnamenow consistently use forward slashes (/). - File System:
delete-fileanddelete-file*now behave identically when encountering broken symlinks.
CSI & Debugging
- The "feathers" debugger is no longer part of the core; it is now an egg.
has been removed from theset-describer!csimodule.
Installation & Config
chicken-install now implements locking for the cache directory. In egg specifications, csc-options and link-options now support custom-config forms.
Important Note on Tool Arguments: Tool paths containing spaces are now handled without requiring double-quotes. However, as a result, the system no longer accepts space-separated flags for tool arguments.
If you require specific flags, please wrap the tool call in a short shell script.
Miscellaneous
loadandload-relativenow allow the second optional parameter to be either an evaluation procedure or an environment.- Added
number-vector-datato the(chicken memory representation)module.