Repository navigation
[Query] Ambient Access
Generated from 'wiki-query.ts' on 2026-11-08, 17:31:23 UTC (v2.17.4), do not edit directly.
Ambient Access Query [overview]
What code reads and writes of the global state
This query is requested with the type ambient-access.
Run in the REPL: :query @ambient-access [(<crit>;...)] <code | file://path>
This query reports what code reads and writes of the global state, such as options, environment variables,
the working directory, open devices, or the search path, as the pseudo variables of AmbientStateName
(#option:digits, #env:A, ...). A call counts with what the functions it calls access, so f() above writes digits.
It also names the global variables the code binds (x <<- 1) and the drawing calls it makes.
The same is available in code as Dataflow.sideEffects.ambientAccess.
Without criteria, the query answers for every file and for the whole project (<project>):
[ { "type": "ambient-access" } ](This can be shortened to @ambient-access when used with the REPL command :query).
Results (prettified and summarized):
Query: ambient-access (55 ms)
╰ <file 1>: reads: #option:, #option:digits, #options writes: #env, #env:A, #option:digits, #options
╰ : reads: #option:, #option:digits, #options writes: #env, #env:A, #option:digits, #options
Show Detailed Results as Json
The analysis ran (including parsing and normalization and the query) within the generation environment.
The JSON contains the ids of the nodes in question (see the Interface wiki page).
{"ambient-access":{".meta":{},"results":{"<file 1>":{"reads":["#option:*","#option:digits","#options"],"writes":["#env","#env:A","#option:digits","#options"],"assumed":[],"variables":[],"draws":[]},"<project>":{"reads":["#option:*","#option:digits","#options"],"writes":["#env","#env:A","#option:digits","#options"],"assumed":[],"variables":[],"draws":[]}}},".meta":{}}Original Code
f <- function() options(digits = 3)
f()
Sys.setenv(A = "1")With slicing criteria, it answers for each criterion with all the code its node spans, so 3^ asks for the statement on line 3.
Set functions to also learn what calling each function accesses:
[ { "type": "ambient-access", "criteria": [ "2^" ], "functions": true } ](This can be shortened to @ambient-access (2^) "f <- function() options(digits = 3)\nf()\nSys.setenv(A = "1")" when used with the REPL command :query).
Results (prettified and summarized):
Query: ambient-access (28 ms)
╰ 2^: reads: #option:, #option:digits, #options writes: #option:digits, #options
╰ function 7: reads: #option:, #option:digits writes: #option:digits, #options
Show Detailed Results as Json
The analysis ran (including parsing and normalization and the query) within the generation environment.
The JSON contains the ids of the nodes in question (see the Interface wiki page).
{"ambient-access":{".meta":{},"results":{"2^":{"reads":["#option:*","#option:digits","#options"],"writes":["#option:digits","#options"],"assumed":[],"variables":[],"draws":[]}},"functions":{"7":{"reads":["#option:*","#option:digits"],"writes":["#option:digits","#options"],"assumed":[],"variables":[],"draws":[]}}},".meta":{}}Implementation Details
The Ambient Access Query is executed by executeAmbientAccessQuery.
Currently maintained by Florian Sihler and Oliver Gerstl at Ulm University
Email | GitHub | Penguins | Portfolio
- 🧑💻 Developer Onboarding
- 💻 Setup
- 👓 Overview
- 🪟 Interfacing with flowR
- 🌋 Core
- 🧹 Testing & Linting (Benchmark Page)
⁉️ FAQ- ℹ️ Extra Information