-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving capture #1689
Comments
unrelated, but can we make this line slightly more mode-agnostic:
otherwise the example in the "new" help makes no sense when run in WebApp mode. |
@DanGrayson thanks for the help, this now works: i8 : format last capture ///stderr << "hi" << endl///
o8 = "
i1 : stderr << \"hi\" << endl
hi
o1 = stdio
o1 : File
i2 :
" However, I noticed that in a lot of places in the interpreter, Lines 127 to 137 in 0205d20
Changing stderr -> stdError fixes capturing of errors:
i2 : format last capture "error 4"
o2 = "
i1 : error 4
currentString:1:1:(3):[4]: error: 4
" But I'm not sure if there's a more important reason why Lines 2 to 7 in 0205d20
Is it safe to replace them? I did so only for printMessage in 8ad88cd.
|
I think the point of stderr is that it can be used while debugging the more complicated stdError, so your replacement of it seems fine. |
This is a continuation of #1469.
Currently many examples in the documentation of "Macaulay2Doc" are being generated using capture, however, there are still a number of remaining issues when using capture for generating examples, each one is being avoided by one of the lines below:
M2/M2/Macaulay2/m2/examples.m2
Lines 159 to 171 in 2d48ff6
I think it's fairly safe to use capture for other packages as well, but I think it would require a closer review before doing that for every package.
-* no-capture-flag *-
is used to single out specific examples that aren't excluded by any other keyword. Currently, only the following examples have this tag:Variable => T
in the following lines:. As it turns out, the variable "T" (and only this one!) is particularly annoying. See #1627 (comment)
capture still doesn't capture direct printing to either stderr or stdout, hence why any keyword that affects those is currently excluded, like
gbTrace, stderr, stdio, print, <<
.examples that use
notify
may be changed if a file is already loaded, so those are excluded, examples that usestopIfError
anddebuggingMode
are also likely not going to work yet, unless there's some sort of time limit to interrupt capture.Certain actions have a permanent effect:
GlobalAssignHook, GlobalReleaseHook, installMethod
export, newPackage, read, run
aren't well tested yet, the same withschedule, thread, *Task
.load
in effect prevents any of the checks above from working, so it has to be excludedtemporaryFileName
is buggy when the same process uses it repeatedly, so it is excluded, but can probably be fixed.ThreadedGB and RunExternalM2 packages probably shouldn't use capture anyway.
TODO:
A few things listed above can be fixed, but to reiterate, I think the following are the important ones:
capture
forcheck
(see Speeding up running the tests #1708)debuggingMode
andstopIfError
be thread local?)I already have made changes in
capture
to save and restore the values of all exported mutable symbols from all packages, but I'm not confident that this entirely eliminates the risk of capturing one example from affecting the result of future examples.The text was updated successfully, but these errors were encountered: