* libguile/filesys.c (scm_system_file_name_convention): New function.
Exported to Scheme only.
* module/ice-9/boot-9.scm (file-name-separator?, absolute-file-name?):
New predicates.
(file-name-separator-string): New global variable.
(in-vicinity): Use the new procedures.
(load-user-init, try-module-autoload): Use file-name-separator-string.
(load-in-vicinity): Update canonical->suffix. Consistently use the
term "file name" throughout.
* module/ice-9/psyntax.scm (include): Use global `absolute-file-name?'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (expand-body): As required by R6RS, evaluate
the right-hand-sides of internal 'define-syntax' forms and add their
transformers to the compile-time environment immediately, so that the
newly-defined keywords may be used in definition context within the
same lexical contour. Fixes#13509.
* module/ice-9/psyntax.scm (expand-body): Apply source-annotation to an
expression, not to the expression's compile-time environment.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (include): Like `load', interpret relative
paths as being relative to the file that does the `include'.
* doc/ref/api-evaluation.texi: Update docs.
* module/ice-9/psyntax.scm (@): Return top-wrap instead of the wrap
applied to the '@' form, so that the symbol will be interpreted as a
top-level identifier and never refer to any lexical variable.
(@@): Change the syntax used to support R6RS 'library' forms to:
(@@ @@ (mod ...) body). Change the behavior of the documented
(@@ (mod ...) id) form to be the same as that of @, except for the use
of 'private' instead of 'public' in the psyntax mod: use syntax->datum
on the identifier, and return top-wrap instead of the wrap applied to
the '@@' form.
This fixes <http://bugs.gnu.org/10756> reported by Ludovic Courtès.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/r6rs-libraries.scm (library): Use '@@ @@' syntax instead
of the older '@@' syntax.
* test-suite/tests/syncase.test (changes to expansion environment): Use
'@@ @@' syntax.
* module/Makefile.am: Add explicit dependencies for boot-9.go on the
files that it includes: quasisyntax.scm and r6rs-libraries.scm.
* module/ice-9/psyntax.scm (do, case): Comment out these definitions,
which are never used and immediately replaced by definitions in
boot-9.scm.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (subst-rename?, rename-old, rename-new,
rename-marks, make-rename): Remove these unused syntax rules.
Fix description of syntax wraps to match current reality.
* module/ice-9/compile-psyntax.scm: Minimize syntax object literals
embedded in psyntax-pp.scm.
* module/ice-9/psyntax.scm: Rename a few variables so that syntax
objects embedded in macros have no lexical bindings, so that their
minimized syntax objects will have no embedded labels. These labels
were the last remaining gensym counters in psyntax-pp.scm.
* module/ice-9/psyntax-pp.scm: Regenerate. It is now less than one
quarter of its previous size! More importantly, this file no longer
contains any gensym counters, which means that in the future, local
changes to psyntax.scm will usually result in only local changes to
psyntax-pp.scm.
* module/ice-9/psyntax.scm (decorate-source): Set source properties on
any object that satisfies 'supports-source-properties?'. Previously
we used 'pair?' as the predicate.
(source-annotation): Apply 'source-properties' to _any_ kind of source
expression, where previously only pairs were queried. If the argument
is a syntax-object, apply the source-properties to the syntax-object's
expression.
In the peculiar case of a syntax-object whose expression is also a
syntax-object: previously we would iterate, but with this commit we
now call 'syntax-object-expression' only once.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (syntax-violation): Look for source
properties of 'subform' first. If 'subform' has none, 'form' is used.
Previously, the source information of 'form' was used unless 'form'
_itself_ was '#f', in which case 'subform' was used.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (rebuild-macro-output): Fix two bugs that
would cause bogus source properties to be added to vectors and
macro-introduced syntax objects. These bugs were masked by the
limitation that only pairs can be decorated with source properties.
Due to a typo, each vector in the macro output was decorated using the
vector itself as its source. Due to accidental variable capture, each
syntax-object introduced by the macro had its expression decorated
with its own wrap-subst.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (syntax-type): Return an additional value
that contains the entire form in _all_ cases, including for definition
forms. Previously, the entire form was not returned for definition
forms.
(expand-expr): Add an additional argument that contains the entire
form in _all_ cases, including for definition forms. Use it to
include the entire form in error messages, notably for definitions in
expression context. Include the source location information, which
was previously missing from these errors when the rhs expression was
an atom. Improve the "definition in expression context" error message
to be more comprehensible for Scheme beginners.
(expand-top-sequence, expand, expand-body): Adjust as needed to handle
the additional return value from 'syntax-type' and the additional
argument to 'expand-expr'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* NEWS: Update.
* libguile/macros.c (scm_init_macros): Add definition of new
syntax-session-id helper.
* module/ice-9/psyntax.scm: Capture a reference to syntax-session-id at
boot time. Uniquify marks and labels using the session id.
* module/ice-9/boot-9.scm: Shunt syntax-session-id off to (system
syntax) once we finished booting.
* module/ice-9/compile-psyntax.scm: Override syntax-session-id when
remaking psyntax to avoid spurious diffs.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/boot-9.scm:
* module/ice-9/psyntax.scm (syntax-module, syntax-local-binding)
(syntax-locally-bound-identifiers): After boot, move these definitions
to a new (system syntax) module.
* module/ice-9/psyntax-pp.scm: Regenerate.
* doc/ref/api-macros.texi: Add some words about syntax-module and
friends being in (system syntax).
* module/ice-9/boot-9.scm (syntax-local-binding): New binding.
* module/ice-9/psyntax.scm: Locally define a fluid that holds the
"transformer environment". with-transformer-environment calls a
procedure with the transformer environment, or raises an error if
called outside the extent of a transformer. Bind
transformer-environment in expand-macro.
(resolve-identifier): Backport this helper from master.
(syntax-local-binding): New procedure to return binding information of
a bound identifier (a lexical, macro, a pattern variable, a displaced
lexical, a global, or some other form).
* module/ice-9/psyntax-pp.scm: Regenerate.
* doc/ref/api-macros.texi (Syntax Transformer Helpers): Add docs for
syntax-local-binding, and syntax-source, and move some other
descriptions to this new section.
* module/ice-9/psyntax.scm (define-syntax-parameter): New toplevel form.
Will be used to implement syntax parameters, following Barzilay,
Culpepper, and Flatt's 2011 SFP workshop paper, "Keeping it Clean with
syntax-parameterize". Adds a new binding type and definition form.
Conflicts:
module/ice-9/psyntax.scm
* module/ice-9/psyntax.scm (define-expansion-constructors)[begin-form]:
Emit a syntax-violation error for empty sequences when
--disable-deprecated.
* test-suite/tests/syntax.test (pass-if-syntax-error): Fix typo in error
message.
* doc/ref/api-control.texi (begin): Update to distinguish between
splicing begin and sequencing begin.
* module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim
for `(begin)'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/syntax.test: Update to run illegal (begin) test only
if we are not including deprecated features.
* module/ice-9/psyntax.scm: Rename expand-when-list to parse-when-list,
and simplify to compare literal values.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm: Rename all instances of "chi" to "expand".
Addded a hack to expand-eval-when that will be fixed later.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/psyntax.scm (chi-top-sequence): Detect bindings to
identifiers introduced by macros. In that case, in order to preserve
hygiene, uniquify the variable's name, but in a way that is
reproduceable (i.e., yields the same uniquified name after a
recompile).
* module/ice-9/psyntax.scm (id-var-name): For mapping identifiers to
toplevel definitions, also compare against the module.
(resolve-identifier): Pass the module to id-var-name when looking up
identifiers.
(free-id=?): Adapt to id-var-name change.
(chi-top-sequence): When adding a mapping from the given identifier
to a toplevel definition, make the name be a pair.
* module/ice-9/psyntax.scm (resolve-identifier): Take an additional
argument, indicating whether syntax parameters should be resolved or
not. Just return three values: the binding type and value, and the
module for resolving toplevels.
(chi-install-global): Take an extra arg, the type. If we are defining
a syntax parameter, construct a pair for the binding.
(chi-body): Syntax parameters now use a per-parameter unique value (a
pair) as a key in the expansion-time environment `r'.
(syntax-parameterize): Don't allow parameterization of
non-parameters. This is an incompatible change, but it is for the
better; you don't want to allow users to parameterize `lambda', after
all.