add --experimental:vmopsDanger
; add generic conversion for vmops
#13813
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this PR adds
compiler/vmconv.nim
with genericproc toLit*[T](a: T): PNode
to convert a concrete type to a PNode (it works recursively).fromLit
is also added for reverse direction. I only implemented the branches that were needed to support the vmops introduced, but it's easy to make it more complete in future PRs as needed. This avoids tedious manual conversion.it PR also adds
--experimental:vmopsDanger
to enable certain operations in VM that I and others need.Since this is hidden behind a flag, only code that needs this feature will be able to use it.
can close staticExec removes trailing LF which interferes with binary output that happens to end with 0xA #13786 by providing a more flexible alternative
often requested
This was also requested in several occasions, eg:
nimterop also needs a lot of functions at CT (by design) and currently to resort to using
staticExec
which, I've argued in several places (eg https://forum.nim-lang.org/t/6058#37491) is often not the right tool (error prone / os specific shell commands, requires manual serialization/deserialization, inefficient, and many other drawbacks you encounter once you start using it more)staticExec
is too limited (eg, no flags, and other issues), this PR provides a workaround that should close staticExec removes trailing LF which interferes with binary output that happens to end with 0xA #13786; IMO it's better to reuse stdlib's osproc API's than re-invent another proc with different semantics that keep tripping users; caching (as done in staticExec) can always be done via a separate / orthogonal API egcache(execCmdEx(...), ... )
usable at both RT and CTexample after PR:
nim c -r --experimental:vmopsDanger t10460.nim
workslinks