Add `file-position*', which can return #f instead of raising
an exception when a port's position is unknown. Change
`make-input-port' and `make-output-port' to accept more
kinds of values as the initial position.
These changes make it possible to synchronize a port's
position with a `port-commit-peeked' action. It's ugly,
which I think reflect something broken about position
tracking in the port protocol (which seems difficult to fix
without breaking compaibility).
Providing a port instead of a reading or writing procedure
redirects the read/write to the specified port. This shortcut
is kind of a hack, but the run-time system can easily streamline
the redirection when it's exposed this way.
Using the new redirection feature reduces overhead in
`with-output-to-bytes' and `pretty-print'.
Since SIGHUP normally means that the output has gone away,
don't try to write to it.
Closes PR 13058 (although it doesn't solve the more general
problem that is noted in the PR)
conventions in 9.2.1 of the reference (altho the messages do
not yet do the extra level of indenting when a field is too
long, nor are there any field names ending in ...)
Also, fix the docs for the #:stronger argument to
make-contract, make-chaperone-contract, and make-flat-contract
A progress evt from a close input port must be initially ready,
and the primitive `peek-bytes-avail!' checks a progress evt
before checking whether the port is closed.
These changes resolve a race in `read-bytes-evt' and related evt
constructors.
Leave it working in splicing mode. I prefer doing that over always
splicing them, since that would make a less uniform interface, so I
rather keep all options open. There is no longer a `#:nothing' keyword,
which is the main point of this downgrade.
(See mailing list discussion on "no-argument" for the reason.)
When a module is loaded from bytecode and then the value of
`use-compiled-file-paths' changes, an attempt to load a submodule
would fail, because source isn't used if the main module is
already declared, and the bytecode code is not used according to
`use-compiled-file-paths'. Make the bytecode path stick when it
is used once, so that submodule loads succeed, and make it work
even with `namespace-module-attach'.
The module-attach part of this protocol requires a change to the
API of a module name resolver: the notification mode gets two
arguments, instead of one, where the second argument is an
environment.
The libraries moved were:
- mzlib/control => racket/control
- mzlib/date => racket/date
- mzlib/deflate => file/gzip
- mzlib/inflate => file/gunzip
- mzlib/port => racket/port
- mzlib/process => racket/system
- mzlib/runtime-path => racket/runtime-path
- mzlib/shared => racket/shared
- mzlib/unit => racket/unit
- mzlib/unit-exptime => racket/unit-exptime
- mzlib/zip => file/zip
The old modules in mzlib are now pointers to the
new modules. These are all modules that were already
redirected in the documentation.
The new names are `prompt-tag/c` and `continuation-mark-key/c`
to keep the names consistent with the values that are being
contracted. Also updated the HISTORY file.
Add a `#:nothing' argument so the no-value value can be
made explicit --- based on discussion with Eli, but pending
further review.
Also, renamed `#:first' to `#:before-first' and `#:last' to
`#:after-last' to be more clear, more parallel ro `#:before-last',
and avoid a collision with prominent function names.
The generics library now generates a `name/c` macro
for a generic interface `name`. The combinator can be
used to contract instances (or constructors) of a
generic interface across standard contract boundaries.
See PR 12860; some of problem related to the PR were "fixed" by
adjusting the guarantees that are specified in the documentation.
Another problem was that non-consecutive bytes could be returned.
For all currently supported platforms, the result was already
portable, despite the documentation's hedging.
Also fixed up the documentation in other ways, such as the fact
that `seconds->date' returns a `date*'.
* The old function was removed completely, people will get it from
`racket/base' anyway.
* I also removed its documentation. I thought about leaving a note in,
but if `define-ffi-definer' is the preferred style, then this should
be done when there's a way to make `define-ffi-definer' use it. (Eg,
some new #:keyword that adds a way to change the defined name.)
* Note that the function is added to `racket/private/string' and not to
`racket/string' because the latter deals only with strings, and the
new function accepts byte strings too. It might be better to start a
new `racket/regexp' module for these functions.
Add extra intitial-message lines, use "..." on a field name
to indicate that it could reasonably be hidden by default,
and refine some existing messages.
Includes the addition of 'overflow and 'start-overflow-work
events, whcih are effectively specializations of 'sync and
'start-work to expose overflow handling.
Also, fix a bug related to a potential GC during mark-stack
restore from a lightweight continuation.
Added alises for call-with-continuation-prompt,
abort-current-continuation, and call-with-composable-continuation.
Also allow % and fcontrol to take an optional prompt tag argument.
The new predicates are `progress-evt?' `thread-cell-values?',
`prefab-key?', `semaphore-peek-evt?', and `channel-put-evt?'.
These were used internally, and now they appear in contract
error messages.
When supplying an accessor to redirect, either the corresponding field
must be accessible through the current inspector, or a mutator for
the same field must be redirected, too.
Stevie realized that we need this constraint; otherwise, impersonators
can implement mutator-like behavior even when the mutator is otherwise
secret.
Add `raise-argument-error', `raise-result-error', `raise-arguments-error',
and `raise-range-error'.
The old convention was designed for reporting on a single (sometimes very
long line). The new convention is
<name>: <short message>
<field>: <detail>
...
If <detail> is long or itself spans multiple lines, then it may
also use the form
<field>:
<detail>
where each line of <detail> is indented by 3 spaces.
Backtrace information is shown as a multi-line "context" field.
The text that says that (regexp-split #rx"whatever" "") returns '("")
rather than '() is
If `input' contains no matches [...] the result is a list containing
input’s content [...] as a single element.
This is a little implicit, if you consider such an input as having
nothing left to match over so it's as if there is no input (with a port
this confusion is a little clearer).
Clarify with an example in the docs, and also add tests.
Various repairs --- especially to avoid duplicated prose.
Instead of
@(define explain @t{Long explanation about X...})
@defproc[(a ....) ....]{ .... @|explain| }
@defproc[(b ....) ....]{ .... @|explain| }
@defproc[(c ....) ....]{ .... @|explain| }
write
@defproc[(a ....) ....]{ .... Long explanation about X ... }
@defproc[(b ....) ....]{ .... X is like @racket[a]. }
@defproc[(c ....) ....]{ .... X is like @racket[a]. }
Otherwise, a reader is forced to reverse-engineer the
abstraction underlying `a', `b', and `c'.
The properties appear in the inlining expansion of an application
of a keyword-accepting function, and they're mainly intended for
use by Typed Racket.
The property keys are hidden, so that the property value can be
trusted as originating from `racket/base'. The accessor functions are
`syntax-procedure-alias-property' and
`syntax-procedure-converted-arguments-property' from
`racket/keyword-transform'.
In consultation with Ryan. We'd prefer to have versions of all
useful things in a `racket/...' library that is consistent as
possible with Racket forms and conventions.
This reverts commit f3b687c8ed.
After discussion with Robby and Stevie, we concluded that
this procedure isn't necessary for now. If we ever think
of more examples where it's useful we can bring it back.
a chaperone contract", "no it definitely isn't" or "evaluate this code
at runtime to find out"; previously only the first two options
were available to opters
(this commit also includes other tweaks here and there so won't stand alone)
These primitives atomically update a box to a new value, as long
as the current value is the same as a provided value. They also
are future-safe.
When futures are enabled, they use low-level hardware instructions
to perform the change atomically.
The example relied on the current code inspector affecting
syntax object created during `eval', but since the switch
from certificates to taints, the relevant code inspector is
determined by the namespace, and a namespace gets its code
inspector at creation time.
Closes PR 12717
The preserved path is exposed by a new `module-path-index-submodule'
function, and `module-path-index-join' now accepts an optional
submodule path.
Also, fixed a problem with `collapse-module-path-index' when
a module path indx is built on a resolved module path that
is a submodule path.
In addition to the main repair, `collapse-module-path[-index]' is
correctly documented to allow '(quote <sym>) rel-to paths.
Finally, `collapse-module-path-index' changed to use a symbolic
resolved module path that appears as the base of a module path
index, rather than falling back to the given rel-to path. It's
possble that the old beavior was intentional, but it wasn't tested,
and it seems more likely to have been a bug.
Closes PR 12724