SCARP v0.0.6-alpha.3 · COMPILER-VALIDATED WORKSHOP
Trace symbols across Scarp modules
Follow two different base bindings, imported public definitions,
named arguments and a counted loop. Learn how inspect symbols differs
from inspect references without executing ordinary statements.
Verify
scarp verify tutorials/source-navigationInspect
scarp inspect references --json tutorials/source-navigationLaunch
scarp launch tutorials/source-navigationBefore launching, also try
scarp inspect symbols --json tutorials/source-navigation.
Both inspection commands type-check the source graph and emit metadata;
they do not execute the interpreter or produce the checked-in output.
Symbol IDs are local to a single inspection and file display paths vary.
EXPLORE STATIC LINKS · बिना कोड चलाए
Click a name to trace its uses
Choose a highlighted declaration or use in either file. The matching source positions and explanation are linked below. This is an editorial teaching map checked against the pinned compiler, not a live language server or browser-based Scarp execution.
Select a highlighted name to trace it, or follow the links to a description without JavaScript.
src/main.srp
import "lib/navigation_values.srp" as library;
bind base = library.offset;
pure funcra twice(value: integer = library.offset) -> integer
needs value >= 0;
ensures result == value * 2;
{
return value * 2;
}
var total = 0;
repeat 3 as step {
bind base = twice(value: library.adjust(n: base + step));
total += base;
}
print(total);
src/lib/navigation_values.srp
bind private_seed = 2;
pub bind offset = private_seed;
pub pure funcra adjust(n: integer) -> integer { return n + offset; }
Definitions and their use sites · घोषणाएँ और प्रयोग
- library import_alias
Alias for the imported module. Each library.member access uses this namespace.
दूसरे मॉड्यूल के लिए इम्पोर्ट नाम। हर library.member में यही नाम प्रयोग होता है।
- base binding
The outer base is declared before the loop. The inner base initializer reads this declaration.
लूप के पहले बाहर वाला base घोषित है। अंदर वाले base की शुरुआत इसी नाम से होती है।
- base binding
The loop-local base is a different binding; the total accumulator reads this one.
लूप के अंदर वाला base अलग बाइंडिंग है। total में इसी का मान जोड़ा जाता है।
- twice function
A pure function called from the loop. Its value argument is named.
लूप से कॉल किया जाने वाला pure फ़ंक्शन; इसका value नाम वाला पैरामीटर है।
- value parameter
The named argument value: resolves to this parameter, not to another variable.
value: नाम वाला आर्गुमेंट इसी पैरामीटर से जुड़ता है।
- total binding
A mutable accumulator. += both reads and writes it before print reads it.
यह बदल सकने वाला कुल मान है; += इसे पढ़ता और लिखता है।
- step repeat_index
The repeat loop index is referenced inside the inner initializer.
repeat लूप का इंडेक्स अंदर वाले initializer में उपयोग होता है।
- private_seed constant
A private module constant used to initialize the public offset.
दूसरे मॉड्यूल की निजी स्थिर राशि, जिससे सार्वजनिक offset बनता है।
- offset constant
Public offset is referenced both from the entrypoint and inside its own module.
सार्वजनिक offset मुख्य फ़ाइल और अपने मॉड्यूल, दोनों से उपयोग होता है।
- adjust function
An imported public function called with the named argument n:.
दूसरे मॉड्यूल का सार्वजनिक फ़ंक्शन, जिसे n: नाम के आर्गुमेंट से बुलाते हैं।
- n parameter
The named argument n: in the entrypoint links to this imported parameter.
मुख्य फ़ाइल का n: आर्गुमेंट इसी दूसरे मॉड्यूल के पैरामीटर से जुड़ता है।
View unannotated files and copy code · मूल कोड देखें
src/main.srp
import "lib/navigation_values.srp" as library;
bind base = library.offset;
pure funcra twice(value: integer = library.offset) -> integer
needs value >= 0;
ensures result == value * 2;
{
return value * 2;
}
var total = 0;
repeat 3 as step {
bind base = twice(value: library.adjust(n: base + step));
total += base;
}
print(total);
src/lib/navigation_values.srp
bind private_seed = 2;
pub bind offset = private_seed;
pub pure funcra adjust(n: integer) -> integer { return n + offset; }
expected.stdout
30
EXPLORE THE SOURCE
Definitions are not the same as uses
Definitions: the imported module declares public
offset and adjust, plus private
private_seed. The entrypoint declares an import alias,
a function named twice, and two separately scoped
base bindings.
References: the inner base initializer reads
the outer base, while total += base reads
the inner one. Named argument labels value: and
n: refer to function parameters. The counted
step variable belongs to the repeat loop.
Try it: inspect the project
and the entrypoint file separately. Find both base definitions and
their reference targets. Then launch and compare the program's only output
line with the fixture. Do not compare symbol ID numbers between invocations.
घोषणाएँ: दूसरे मॉड्यूल में सार्वजनिक offset और
adjust तथा निजी private_seed हैं।
मुख्य फ़ाइल में library इम्पोर्ट नाम, twice
फ़ंक्शन और अलग स्कोप के दो base बाइंडिंग हैं।
उपयोग: अंदर वाले base का प्रारम्भिक मान
बाहर वाले base से बनता है। total += base
अंदर वाले मान का उपयोग करता है। value: और n:
फ़ंक्शन पैरामीटर के नाम हैं; step लूप की गिनती है।
अभ्यास: प्रोजेक्ट और
src/main.srp दोनों पर निरीक्षण चलाएँ। base की
दो घोषणाएँ और उनके उपयोग खोजें। फिर launch का वास्तविक परिणाम
expected.stdout से मिलाएँ। अलग-अलग जाँच की symbol IDs की
तुलना न करें।
Pinned published
v0.0.6-alpha.3
· source ceff07d9014f.
Read-only metadata is not program output. The browser does not execute Scarp.
Which base is read inside twice(value: library.adjust(n: base + step))?
The outer base. The inner binding is not visible until its initializer is resolved.
बाहर वाला base। अंदर वाले बाइंडिंग का नाम उसके initializer के बाद उपलब्ध होता है।
Why can the source inventory be inspected without printing 30?
Inspection performs static name/type checking. Only launch executes the program and produces the exact stdout fixture.
निरीक्षण केवल नाम और प्रकार की स्थिर जाँच करता है; launch प्रोग्राम चलाकर 30 प्रिंट करता है।
← First inspect project modules · Project basics · Source provenance and license