Committed as a checkpoint, since I convinced myself that a single
function with a keyword is better, given that the rest of the simplified
functions operate on the whole string.
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.
Since mixins rely on super calls to possibly abstract
methods, we want to ensure that the super call will not
error when it gets to an abstract method. However,
external method calls should still raise an error for
abstract methods.
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'.
For example, if definitions have two unmarked `x's that originate
from different modules, make them correspond to different bindings.
This improvement will be used by `scribble/srcdoc', which will
rely on module context to connect `for-doc' requires to documentation
code that appears in the same module --- which is needed, for example,
if a macro expands to documentation code and the macro is used in
a different module.
(this is similar to being flat, but struct contract (lazy ones) can
be non-flat and still have no negative blame).
Use this to optimize struct/dc contracts; specifically when a contract
has no negative blame, then we don't need to add additional wrapping
for indy-ness.
This ended up being fairly tricky to handle the case where there
are several mutually recursive define-opt/c functions. The code
tracks which definitions depend on which ones and does a graph traversal
of the dependencies to find if there is any non-negative blame
possible. Naturally, this uses Racket's macro system to communicate
between the definitions.
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)
Looks like it's not making any changes in the current tests (which use
the text renderer), but with words that are longer than the width the
old version would stop wrapping afetr these words. Added a test file
that fails with that and succeeds with the new one. If anyone cares
about this, it's easy to make hyphenate words that are too long for a
line.
(Also fixed some redundant frustration in the bib test...)
* Make each test file runnable using `module+'.
* Make the space tests not print anything (unless they fail, of course).
* Make the `first-class?' case even "more first class" by defining their
and/or as functions. (Doesn't make a real difference for this test,
but nice to test more of the language.)
This should probably become documented if it's stable enough. For now
it's intended for building wrapping functions, so it's only documented
in comments the file.
Don't put an extra seperator element at the end of the stream. Brings
it in-line with the list version (`add-between') and sequence
version (`sequence-add-between'). Includes a test.
* Use #f instead of (lambda () #f) in hash-ref call
* We want the positive blame, not negative, when interface-contracted
methods are passing through a class/c application.
* Use (interface <i>) and (class <c>) for interface and class blame.
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.
Also, use keywords for `make-pen' and `make-brush'.
Adding `make-pen' and `make-color' creates many conflicts among
teaching libraries, such as `2htdp/image'. These are easy to fix
up in the tree, but adding such obvious names to `racket/draw'
may create other compatibility problems, so we might have to reconsider
the names.
In consultation with Asumu.
Generate wrappers consistent with a reader-level absence of `.'s,
instead of wrapping every pair. This change fixes the `syntax-e'
example in the Guide's description of syntax objects.
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
For example, `(module-declared? '(submod (planet dyoo/bf) reader) #t)'
shouldn't fail if there's no "main.rkt" to hold a `reader' submodule;
it should return #f.
Merge to 5.3, but updating cstartup.inc will require a manual merge.
MySQL:
- support multi-packet data rows
- fixed very old length-coding bug (24 vs 32 bit length)
- support large params via long-data packets
- 'any' pseudo-type for parameters
- distinguish 'blob'/'text', 'var-string'/'var-binary'
- read 'text' results as string, not bytes
SQLite3:
- enabled sql types tests
library (mostly in opt/c)
Specifically:
- add inlining declaration for ->i helper function
- modernized the opt/c contracts and improved them so that mutually
recursive define-opt/c functions recognize each other instead of
bailing out to the slow path.
- added =/c as an optimized contract
- improve the error message for the between and comparison opt
contracts
- adjust the blame struct so the name is created lazily, since opt/c
contracts just stick a copy o the contract into the thunk that
creates the name and we don't want to run those effects twice if we
can help it.
adjust 'one-of/c' and 'symbols' so they just use or/c (when possible)
improve or/c's stronger check so that, in the case that or/c is
getting eq or equal contracts, or/c's stronger check is as good as
'symbols'/'one-of/c's stronger check is.
This distinction is important after the introduction of chaperones and
impersonators, since accessing a key and accessing its corresponding value
may have different effects, and hash-keys should only trigger the former.
The immediate symptom was that `(provide (all-defined-out))'
didn't work in a `module+'-based submodule, but there were
also non-submodule ways to expose the problem.
The `get-handle' method provides the underlying Cairo surface for
a bitmap, while the unsafe `make-handle-brush' function supports the
use of a Cairo surface as a `brush%'.
Also, add `racket/draw/unsafe/cairo-lib', which simplifies access
Cairo from external libraries. Documenting `racket/draw/unsafe/cairo'
might be better, but that's a lot more work.
* Get rid of the concept of `modspec': `getarg' now has `require' for
require specs and `module' for a module name (the latter is what all
previous uses of 'modspec except for ,require really needed); command
descriptions use "<require-spec>" and "<module>", documentation
adjusted as well.
* `module-name?' etc turn to `known-module' and `known-module-name',
with a saner behavior, and tests to keep it sane.
* This cleans up a lot of things. Two specific points: ,switch works
better with toplevel-defined modules (see the corresponding change in
the test suite), and also fixes PR 12148.
* Ensure that ,sh commands return void.
* Add tests for ,r with non-atomic require spec, and for use of $F in
,sh commands.
* Improved the test suite, including uses of `module+' so each file can
be run by itself to perform a subset of the tests.
- changed substitute to use closure-compilation
- added stress/perf test for templates
- updated minimatch with vector patterns
- split substitute into separate file, minimize dependencies
- do ellipsis optimization dynamically
- validate guides: check var indexes
It looks like run-teaching-program hasn't been touched in quite a while.
To begin with, the "rewrite-module" function used to add code to print
out values of non-define exprs, but this is no longer necessary. In fact,
the only thing that it does now is to discard "provide" statements, and
even this may be unnecessary. I rewrote big chunks of this (short) file
to introduce defines, eliminate unnecessary functions, and add stepper-
skip-completely annotations to the requires associated with teachpacks.
Also, it appears that the 'rep' argument to expand-teaching-program
was entirely superfluous; I removed it from the argument list, and also
from the three places in the main tree (deinprogramm, lang, and the stepper)
that call this function.
Let me know of any problems seen with teachpack requires....
The bug happens with n-ary uses of arithmetic operations that
have constant arguments but couldn't be constant-folded ---
maybe due to a divide-by-zero.
Previously, sandbox creation used `gui?', which is the result of
`gui-available?' at the time that `racket/sandbox' is instanited.
This change makes sandbox behavior less sensitive tothe order in
which modules `require'd into a program are intiantiated.
The change depends on a new `sandbox-make-namespace' default
function for `sandbox-namespace-specs'. The new function uses
either `make-base-namespace' or `make-gui-namespace', depending
on whether the GUI library is available at that point.
A new `sandbox-gui-enabled' parameter can disable use of the
GUI library even if it is available.
The `gui?' binding is still exported for backward compatibility,
but it shouldn't be used anymore.
Using the functions on a port triggers renegotiation of the
connection, which s useful for cases such as a web server that
requires a certificate only for certain paths. This functionality
also allows better testing of the SSL library.
Mostly for amusement, including the contrast between
the benefits of closure compilation for a host interpreter
versus the benefits for a host compiler.
The old implementation could cause deadlock by blocking on a semaphore
while waiting for the original place to run a callback, but a master
GC might be needed (and the blocked place wouldn't get the signal).
Beside fixing that problem, a potential memory leak is fixed in
calling an ffi funcition and having a Racket->C unmarshaling fail.
Also, the GC marking routine for a `place' value didn't reference the
place's underlying `place_obj' value.
The eopl language is now racket-based rather than mzscheme-based. This
test-suite, which was originally distributed on the book's web-site has
been re-written in the new language. Changes include dropping all
drscheme-init.scm and top.scm files. Remaining files were renamed to
use the .rkt extension and edited to use the #lang syntax (instead of
modulue). Require and provide forms were changed to reflect racket's
syntax instead of mzscheme's (eg, only-in vs. only). Several
occurrences of one-armed ifs were changed to use when and unless. All
tests have been run successfully.
The bug is triggered by unsafe flonum operations, a
conversion that tries to make the arguments more unboxable,
and a `lambda' form within an argument to the unsafe
operation.
Closes PR 12587
The `or' and `and' functions already worked correctly; this
fix is for `or' and `and' as applied directly to arguments, which
expands to the `racket/base' `or' and `and' forms.
Treat a "face" as a font description only if it has a comma,
otherwise go back to treating it as a family name.
This change fixes the problem of parsing "Times New Roman"
as "Times New, Roman".
The ActiveX part of MysterX is gone. The `ffi/com' re-imeplemtnation
provides only core COM support.
The "mysssink" DLL is still needed, and its source is still
in the tree, but it is downloaded in the same way as other
pre-built DLLs. The DLL no longer needs to be registered with
regsvr32.
The prohbition against `handle-evt' on `handle-evt' is as
document and as originally intended. I'm not sure why it
was allowed.
Existing programs that use `handle-evt' incorrectly
can break. I found and fixed one incorrect use and one
questionable use in the Racket tree (which is a small
minority of the uses of `handle-evt' in the tree).
Extend `define-cstruct' to support #:property specs, which causes
the constructor and C->Racket coercsions to wrap the pointer in
a structure instance with the specified properties. Of course,
the wrapper structure has a `prop:cpointer' property so that the
wrapper can be used transparently as a C pointer.
Add missing tests and documentation for the id`->list', `list->'id,
id`->list*', and `list*->'id bindings created by `define-cstruct'.
When an eventspace is created, its thread implicitly calls
`yield'. It now effectively loops with `yield' and while
catching continuation aborts.
Closes PR 12566
This addition triggered several other changes:
* -k for a Mac OS X embedding is now relative to the __PLTSCHEME
segment (which means that executables won't break if you strip
them, for example)
* the command-line no longer has a limited size for Mac OS X
launchers and embedding executables
* Mac OS X GUI and Windows launchers record the creation-time
collection path, unless they are created as "relative" launchers
In particular, allow a pair of a relative-to directory and a base
directory. Paths that syntactically extend the base directory are
recorded as relative to the relative-to directory (which must
syntactically extend the base directory).
The compilation manager now sets the parameter to a pair with
the base directory as the main collection directory, if the source
file's path extends that directory's path.
This generalization solves problems created by cross-module inlining,
where the source location of a procedure in bytecode can now be in a
different file than the enclosing module's file.
Also add a test that checks whether the build directory shows up
in any ".zo", ".dep", or documentation ".html" files.
Closes PR 12549
To get the expected contents of the various environment variables, I
used a similar approach to what the build does in `grab_batch_vars':
* Start a cmd.exe shell (not a real shell)
* Dump the env into a buffer
* Run "... Studio/VC/vcvarsall.bat" (modifies envvars, which is why cmd
is needed)
* Dump new env into a new buffer
* Sort both buffers and compare
Hopefully it still works also on Matthew's setup.
Two other small things:
* Use ".obj" suffix on windows to avoid warning.
* Catch error when trying to delete the .so file, since on the x86_64
machine it throws an error. (I'm not sure how it *doesn't* do that
with the i386 machine.)
Certain `lambda'-lifting operations can cause information
about the flonumness of a variable to get lost, leading
to a mismatch between the closure's flags and flags on
a variable reference. (The bytecode validator could detect the
bug when loading the broken bytecode. The broken information,
meanwhile, was only used by the JIT.)
The two became tangled in commit f7c16fc8, and then 952ae06105
adjusted the tangling in a way that broke code. This commit
further adjusts tangling in a way that hopefully causes fewer
compatibility problems, but it also splits inputs to
`make-evaluator' so that a programmer can choose more explicitly.
coloring for blame assignment in check syntax) try to color
the right-hand side of a binding that actually comes from
a lambda-bound variable (and thus crash for not finding the
right-hand side)
The generated code was checking arity after potentially copying
arguments to the start of the runstack (i.e., if the arguments
were not already there). If too few arguments are provided, then
the copy might access past the end of the given array.
The redundant arity check removed in commit f7c506471b
had previously masked this problem. (Or the check wasn't redundant
in that sense, but it's better this way.)
Merge to 5.2.1
Certain unsafe operations were allowed to propagate across a
`lambda' boundary (where space safety is known not to be an issue),
which could lead to duplicate uses of a "once used" variable if
the relevant `lambda' is inlined.
Furthermore, `lambda' boundary crossing wasn't detected in the case
that the operation to propagate was propagated through an intermediate
variable without a `lambda' crossing.
Merge to 5.2.1
Rename `read-intern-literal' to `datum-intern-literal'.
Interning is needed only in `read-syntax' or `datum->syntax' to
set up the invariants that the bytecode compiler needs for cross-module
optimization. When `read'ing numbers from a data file, meanwhile,
interning slows things down a lot and doesn't seem worthwhile.
This library is used by Redex, which wants a `syntax'-like template
language, but for datum values instead of syntax objects. Using
`datum-case' and `datum' generates much less code. Redex uses
only a small part of the general functionality, so adding
`syntax/datum' could be overkill. It's implemented by generalizing
the `syntax-case' and `syntax' pattern matching and template
constructing code, though; it's not a lot of extra code, and it's
easiest to generalize completely. We may find other uses for
datum templates, too.
The over-eager transformation could be space-unsafe, and it
could duplicate an unsafe operation whose result is used only
once in a function that eds up being inlined multiple times.
More generally, support a
(define _id (begin 'compiler-hint:cross-module-inline _proc-expr))
hint, which is how the compiler determines that `map', etc., are
candidates for inlining.
The psyntax implementation relies on 3-D syntax like
(let ([s (string #\i)])
(eq? s (eval `',s)))
producing true, or maybe
(let ([s1 (string #\i)]
[s2 (string #\i)])
(eval `(eq? ',s1 ',s2)))
producing false, or probably both. Neither works now
in Racket. Hack around the problem well enough for
benchmarking purposes by using numbers in place of
strings.
and the magic fixup of opening parentheses.
This commit moves the automatic insertion of matching parens to the
scheme mode keymap, so it will now take affect in Racket mode editing,
only. Also, Rackety.
An unreceived message can have a reference to a master-allocated
value, in which case that value must be marked. This marking
is implemented by embedding a linked link within the message
memory.
change the implementation to special case struct procedures and to use
it in provide/contract.
This speeds up the rendering phase of the Guide documentation by more than 2x.
Thanks to Matthew for spotting the opportunity!
(since the repl test suite tests the pretty big language's repl and since there was a test case
there that would have discovered a bug that we only found in the hours before the release but had
been lurking for a few days)
and change the tests so they all run with port line
counting enabled (or else the unicode test fails)
adjust module-lexer.rkt tests so they can run in either
port-counting mode or not (but currently run them all in
port-counting mode because scheme-lexer doesn't work without it)
also make a first stab at what needs to change in the module
lexer to make it work in non port line-counting mode
checking of the syntax (that it can) and then just throws everything
to the end of the module, instead of trying to have it figure out
what the actually provided variables are at the beginning.
closes PR 12295
This commit fix an unintentional change introduced by this commit:
c7d67f9bab
(and it also adds in test cases for what that commit appears to have
been doing)
Assuming everyone agrees that the behavior for first rest from back
in 2010 is the behavior we still want (and the lack of release notes
on the subject makes me believe that we do), then:
Please include in 5.2.
Fix memory accounting to detect when messages pile up in a
place channel and when shared values (such as the result of
`make-shared-bytes') pile up. Also fix problems where a GC
or free-page purge needs to be triggered.
The implementation causes a minor API change, which is that
a place channel sent multiple times as a message generates
values that are `equal?' but no longer eq?'.
Closes PR 12273
[Do not merge to 5.2]
In particular, instead of trying to collect all of the arrows and do some kind
of a smart transitive closure (that tries to avoid adding links that would "skip"
expressions but doesn't always manage it), the new code tries instead to build
the right links directly while traversing the fully expanded expression
This also seems to have been a minor performance improvement. When running the
information collection phase of check syntax (ie, not counting the time for
expansion) on a 1.8 GHz core i7, for collects/framework/private/text.rkt,
the times went from:
cpu time: 7347 real time: 7413 gc time: 211
cpu time: 7328 real time: 7393 gc time: 239
cpu time: 7356 real time: 7418 gc time: 240
to:
cpu time: 7562 real time: 7632 gc time: 265
cpu time: 7555 real time: 7618 gc time: 269
cpu time: 7552 real time: 7617 gc time: 262
closes PR 11835
do not include in 5.2
Reordering `unsafe-vector-ref' past an `unsafe-vector-set!' was
particularly bad. Meanwhile, some non-mutating operations like
`unsafe-mcar' were treated too conservatively.
Merge to 5.2
The bug was that a procedure could be incorrectly marked as
a "leaf" procedure, which could in turn cause the compiler
to keep inlining a very small procedure that calls itself.
Closes PR 12270
Merge to 5.2
'read-language' uses as a single token in the case that read-language
fails. This helps it to deal with things like s-exp and at-exp
properly
closes PR 12260
with drdr
also change two of the failing tests so they pass, but incorrectly and
add a note there to that effect so if someone does fix that eventually
they won't be confused (I hope)
this situation:
<a x="<b
and, in particular, not do this:
<a x="<b></b>
Looking into this a bit, it isnt' clear how to do this without actually
parsing the whole buffer, something that doesn't seem to be worth
the effort with the amount of use that the XML boxes seem to get
So, for now: closes PR 5440
The `date*' structure type is an extension of `date' with
`nanosecond' and `time-zone-name' fields.
The `seconds->date' function now accepts a real and returns a
`date*'. The fractional part of its argument goes into the
`nanosecond' field.
Macros and other tools that need syntax privilege used
`(current-code-inspector)' at the module top-level to try to
capture the right code inspector at load time. It's more
consistent to instead use the enclosing module's declaration-time
inspector, and `var-ref->mod-decl-insp' provides that. The
new function works only on references to anonymous variables,
which limits access to the inspector.
The real function name is longer, of course.
The GC problem was related to generational GC and the way constant
values are associated to JIT-generated code. See `retaining_data'.
The stack-overflow problems affects the JIT, module expansion,
and module invocation.
Previously, when trying to `enter!' into a module, an exception would
abort the whole thing, leaving the repl where it was. This behavior can
be very confusing:
> (module foo racket/base (define x 123) (error "bleh!"))
> (enter! 'foo)
bleh!
> x
reference to undefined identifier: x
> (enter! 'foo)
> x
123
Things are a little better with xrepl, since the prompt always indicates
the module that you're in. Still, it's unfortunate that a module with
an error is more likely to be something you'd want to debug -- and most
people are likely to miss the fact that entering a second time will work.
So make `enter!' catch exceptions when requiring the module, change the
namespace, and then re-raise the exception so the user sees it and is
left in the expected namespace.
Since that requires `racket/draw', which requires libcairo, which is
missing on some build machines. It might be needed in the future, but
for now it's better to make it easier to add build machines.
Finalization for a place channel used a recursive, non-atomic
function, which meant that a thread switch could happen during
place-channel finalization, leaving the new thread with the
master GC and generally confused. (The random-message test
found the bug right away on my machine.)
We already have a non-recursive, non-atomic function to traverse
place messages, so collapse all modes into that one implementation.
Along the way, problems with empty structs (found by random tester)
and checking of file descriptors (test added) also fixed.
The `current-memory-use' function's result now includes the memory
use of places created from the calling place, and custodian memory
limits apply to memory use by places (owned by the custodian).
This change is relevant to PR 12004 in that DrRacket will no longer
crash on the example if a memory limit is in effect, but plain
Racket starts with no such limit and will exhaust all memory.